diff options
author | Max Kellermann <max@duempel.org> | 2009-01-08 21:20:46 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-01-08 21:20:46 +0100 |
commit | 5ed5aa99acb6b8360df75bb1ce13d4b97ea50538 (patch) | |
tree | 518a01dabc3c9652fdbb090eb4e8fd97ed725729 /src/update.c | |
parent | f0980283bcce8ad7819f71bc49b973e28e54b22d (diff) | |
download | mpd-5ed5aa99acb6b8360df75bb1ce13d4b97ea50538.tar.gz mpd-5ed5aa99acb6b8360df75bb1ce13d4b97ea50538.tar.xz mpd-5ed5aa99acb6b8360df75bb1ce13d4b97ea50538.zip |
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.
Diffstat (limited to '')
-rw-r--r-- | src/update.c | 8 |
1 files changed, 6 insertions, 2 deletions
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); |