aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-02-12 19:11:26 +0100
committerMax Kellermann <max@duempel.org>2009-02-12 19:12:32 +0100
commitdf9245c2aae7518c813385f7cd721cc17ff27062 (patch)
tree975eeff573b74013b0e6c6bb9562091f2311ce39
parent16bab6019ba400edf15960f6a887702aa85008dd (diff)
downloadmpd-df9245c2aae7518c813385f7cd721cc17ff27062.tar.gz
mpd-df9245c2aae7518c813385f7cd721cc17ff27062.tar.xz
mpd-df9245c2aae7518c813385f7cd721cc17ff27062.zip
update: free deleted subdirectories
Use delete_directory() for removing sub directories instead of dirvec_clear(). This ensures that all memory occupied by subdirectories of deleted directories is 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 8764db1b3..11826c0ce 100644
--- a/NEWS
+++ b/NEWS
@@ -61,6 +61,7 @@ ver 0.14.2 (2009/??/??)
* mapper: remove trailing slashes from music_directory
* player: set player error when output device fails
* update: recursively purge deleted directories
+* update: free deleted subdirectories
ver 0.14.1 (2009/01/17)
diff --git a/src/update.c b/src/update.c
index 90b7cbe8f..17059ffe0 100644
--- a/src/update.c
+++ b/src/update.c
@@ -132,6 +132,9 @@ delete_each_song(struct song *song, G_GNUC_UNUSED void *data)
return 0;
}
+static void
+delete_directory(struct directory *directory);
+
/**
* Recursively remove all sub directories and songs from a directory,
* leaving an empty directory.
@@ -142,8 +145,9 @@ clear_directory(struct directory *directory)
int i;
for (i = directory->children.nr; --i >= 0;)
- clear_directory(directory->children.base[i]);
- dirvec_clear(&directory->children);
+ delete_directory(directory->children.base[i]);
+
+ assert(directory->children.nr == 0);
songvec_for_each(&directory->songs, delete_each_song, directory);
}