summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2010-08-18 00:24:31 +0200
committerJon Bergli Heier <snakebite@jvnv.net>2010-08-18 00:24:31 +0200
commit4f153bf7b20a76da5563f86047a8c0e74436644d (patch)
tree98e8976bed615354fc462cd5f64c4cb397f6ac39
parent4a964b563ca166002ba6cf5b4e20ab29cd8cfff3 (diff)
Fixed memory leaks in music_find_file().
-rw-r--r--music.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/music.c b/music.c
index c68504d..d3c9b64 100644
--- a/music.c
+++ b/music.c
@@ -105,18 +105,22 @@ struct file *music_find_file(const gchar *path) {
gchar *filename = g_path_get_basename(path);
struct directory *directory = music_find_dir(dirname);
+ g_free(dirname);
if(directory == NULL) {
+ g_free(filename);
return NULL;
}
for(GSList *node = directory->files; node; node = g_slist_next(node)) {
struct file *f = node->data;
if(g_strcmp0(filename, f->name) == 0) {
+ g_free(filename);
return f;
}
}
+ g_free(filename);
return NULL;
}