Commit 71da57aefddf25395da141eef8dd854c04bc5771

Carlos Martín Nieto 2011-05-31T16:49:15

Plug a leak in the index unmerged entries vector Signed-off-by: Carlos Martín Nieto <cmn@elego.de>

diff --git a/src/index.c b/src/index.c
index 3897802..f90de2a 100644
--- a/src/index.c
+++ b/src/index.c
@@ -188,6 +188,7 @@ void git_index_free(git_index *index)
 
 	git_index_clear(index);
 	git_vector_free(&index->entries);
+	git_vector_free(&index->unmerged);
 
 	free(index->index_file_path);
 	free(index);
@@ -221,7 +222,15 @@ void git_index_clear(git_index *index)
 		free(e);
 	}
 
+	for (i = 0; i < index->unmerged.length; ++i) {
+		git_index_entry_unmerged *e;
+		e = git_vector_get(&index->unmerged, i);
+		free((char *)e->path);
+		free(e);
+	}
+
 	git_vector_clear(&index->entries);
+	git_vector_clear(&index->unmerged);
 	index->last_modified = 0;
 
 	free_tree(index->tree);