Commit 6b798c3c8a2a1a0b86a2e6fbbe3d3be758f9b56c

Stefan Sperling 2019-01-08T22:22:53

don't forgot to free file index entries in got_fileindex_free()

diff --git a/lib/fileindex.c b/lib/fileindex.c
index 20cc091..d0d1be4 100644
--- a/lib/fileindex.c
+++ b/lib/fileindex.c
@@ -155,9 +155,18 @@ got_fileindex_alloc(struct got_fileindex **fileindex)
 	return NULL;
 }
 
+static const struct got_error *
+free_entry_cb(const char *path, void *data, void *arg)
+{
+	struct got_fileindex_entry *entry = data;
+	got_fileindex_entry_free(entry);
+	return NULL;
+}
+
 void
 got_fileindex_free(struct got_fileindex *fileindex)
 {
+	got_pathset_for_each_safe(fileindex->entries, free_entry_cb, NULL);
 	got_pathset_free(fileindex->entries);
 	free(fileindex);
 }