aboutsummaryrefslogtreecommitdiffstats
path: root/src/directory.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-08-15 21:18:38 +0200
committerMax Kellermann <max@duempel.org>2009-08-15 21:18:38 +0200
commitf401c1059c78358b701dbee22ca78035c6e652eb (patch)
tree5cf487eea76b70b91e6acee8f55b6ca135b45a4a /src/directory.c
parente28a0e97b5d2e54684c6452d6d45f64ff1e542d9 (diff)
parent5715534b530cfed0d6650b0fb34cfcb17da4088b (diff)
downloadmpd-f401c1059c78358b701dbee22ca78035c6e652eb.tar.gz
mpd-f401c1059c78358b701dbee22ca78035c6e652eb.tar.xz
mpd-f401c1059c78358b701dbee22ca78035c6e652eb.zip
Merged release 0.15.2 from branch 'v0.15.x'
Conflicts: NEWS configure.ac
Diffstat (limited to 'src/directory.c')
-rw-r--r--src/directory.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/directory.c b/src/directory.c
index 85c24fd04..ef8c038a3 100644
--- a/src/directory.c
+++ b/src/directory.c
@@ -73,9 +73,14 @@ directory_prune_empty(struct directory *directory)
struct dirvec *dv = &directory->children;
for (i = dv->nr; --i >= 0; ) {
- directory_prune_empty(dv->base[i]);
- if (directory_is_empty(dv->base[i]))
- dirvec_delete(dv, dv->base[i]);
+ struct directory *child = dv->base[i];
+
+ directory_prune_empty(child);
+
+ if (directory_is_empty(child)) {
+ dirvec_delete(dv, child);
+ directory_free(child);
+ }
}
if (!dv->nr)
dirvec_destroy(dv);