aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-08-14 11:51:51 +0200
committerMax Kellermann <max@duempel.org>2009-08-14 11:51:51 +0200
commit5d6f7803e1059f527a70e541ed3945c19bd78c90 (patch)
tree27f1bec5d01a1946a15b0badfabc07d7eb3f08fc
parent1c4f407a6db4c4795bbbc354f5cf311762fb8e33 (diff)
downloadmpd-5d6f7803e1059f527a70e541ed3945c19bd78c90.tar.gz
mpd-5d6f7803e1059f527a70e541ed3945c19bd78c90.tar.xz
mpd-5d6f7803e1059f527a70e541ed3945c19bd78c90.zip
update: free temporary string in container scan (memleak)
The return value of map_directory_child_fs() must be freed.
Diffstat (limited to '')
-rw-r--r--NEWS1
-rw-r--r--src/update.c8
2 files changed, 7 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 3da38e8d4..68d700bac 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@ ver 0.15.2 (2009/??/??)
- flac: parse all replaygain tags
- flac: don't allocate cuesheet twice (memleak)
* update: free empty path string (memleak)
+* update: free temporary string in container scan (memleak)
ver 0.15.1 (2009/07/15)
diff --git a/src/update.c b/src/update.c
index 9a2a2ceb9..bdf84ce36 100644
--- a/src/update.c
+++ b/src/update.c
@@ -430,7 +430,7 @@ update_container_file( struct directory* directory,
{
char* vtrack = NULL;
unsigned int tnum = 0;
- const char* pathname = map_directory_child_fs(directory, name);
+ char* pathname = map_directory_child_fs(directory, name);
struct directory* contdir = dirvec_find(&directory->children, name);
// directory exists already
@@ -446,8 +446,10 @@ update_container_file( struct directory* directory,
modified = true;
}
- else
+ else {
+ g_free(pathname);
return true;
+ }
}
contdir = make_subdir(directory, name);
@@ -473,6 +475,8 @@ update_container_file( struct directory* directory,
g_free(vtrack);
}
+ g_free(pathname);
+
if (tnum == 1)
{
delete_directory(contdir);