Commit 58b0cbea74c160c61ec70768568e150c4d31f633

Vicent Marti 2010-07-10T12:14:30

Actually free all commits when freeing a commit pool Previously the objects table was being freed, but not the actuall commits. All git_commit objects are freed and hence invalidated when freeing the git_rp object they belong to. Signed-off-by: Vicent Marti <tanoku@gmail.com>

diff --git a/src/revwalk.c b/src/revwalk.c
index 5d7f65d..c3b53a3 100644
--- a/src/revwalk.c
+++ b/src/revwalk.c
@@ -45,9 +45,18 @@ git_revpool *gitrp_alloc(git_odb *db)
 
 void gitrp_free(git_revpool *walk)
 {
+	git_commit *commit;
+	git_revpool_tableit it;
+
 	git_commit_list_clear(&(walk->iterator), 0);
 	git_commit_list_clear(&(walk->roots), 0);
 
+	git_revpool_tableit_init(walk->commits, &it);
+
+	while ((commit = (git_commit *)git_revpool_tableit_next(&it)) != NULL) {
+		free(commit);
+	}
+
 	git_revpool_table_free(walk->commits);
 
 	free(walk);