Commit 7dddd9be authored by Max Kellermann's avatar Max Kellermann

directory: free empty directories after removing them (memleak)

dirvec_delete() does not free the object, we have to call directory_free() afterwards.
parent 5d6f7803
......@@ -8,6 +8,7 @@ ver 0.15.2 (2009/??/??)
- flac: don't allocate cuesheet twice (memleak)
* update: free empty path string (memleak)
* update: free temporary string in container scan (memleak)
* directory: free empty directories after removing them (memleak)
ver 0.15.1 (2009/07/15)
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment