aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/directory.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/directory.c b/src/directory.c
index 3ebac6830..40be57855 100644
--- a/src/directory.c
+++ b/src/directory.c
@@ -60,8 +60,11 @@ void directory_free(struct directory *dir)
directory_walk(dir, free_each_song, free_each_dir, dir);
dirvec_destroy(&dir->children);
songvec_destroy(&dir->songs);
- if (dir != &music_root)
+ if (dir != &music_root) {
+ assert(dir->parent);
+ dirvec_delete(&dir->parent->children, dir);
free(dir);
+ }
}
static int dir_pruner(struct directory *dir, void *_dv)