From 5ed5aa99acb6b8360df75bb1ce13d4b97ea50538 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 8 Jan 2009 21:20:46 +0100 Subject: path: allocate buffer in fs_charset conversion functions Don't use fixed static buffers. GLib allocates a new string for us anyway, let's just return this one instead of copying it. --- src/update.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/update.c') diff --git a/src/update.c b/src/update.c index 691f533b5..c2a6296cd 100644 --- a/src/update.c +++ b/src/update.c @@ -545,15 +545,19 @@ updateDirectory(struct directory *directory, const struct stat *st) if (skip_path(ent->d_name)) continue; - utf8 = fs_charset_to_utf8(path_max_tmp, ent->d_name); - if (utf8 == NULL || skip_symlink(directory, utf8)) + utf8 = fs_charset_to_utf8(ent->d_name); + if (utf8 == NULL || skip_symlink(directory, utf8)) { + g_free(utf8); continue; + } if (stat_directory_child(directory, utf8, &st2) == 0) updateInDirectory(directory, path_max_tmp, &st2); else delete_name_in(directory, path_max_tmp); + + g_free(utf8); } closedir(dir); -- cgit v1.2.3