Commit 049dbf42f50a7d04db5ab99577455b8933e3d532

Carlos Martín Nieto 2015-09-12T04:00:34

Merge pull request #3421 from ethomson/mempack-fix Mempack fix

diff --git a/src/odb_mempack.c b/src/odb_mempack.c
index 3435527..594a278 100644
--- a/src/odb_mempack.c
+++ b/src/odb_mempack.c
@@ -154,12 +154,16 @@ void git_mempack_reset(git_odb_backend *_backend)
 	});
 
 	git_array_clear(db->commits);
+
+	git_oidmap_clear(db->objects);
 }
 
 static void impl__free(git_odb_backend *_backend)
 {
-	git_mempack_reset(_backend);
-	git__free(_backend);
+	struct memory_packer_db *db = (struct memory_packer_db *)_backend;
+
+	git_oidmap_free(db->objects);
+	git__free(db);
 }
 
 int git_mempack_new(git_odb_backend **out)
diff --git a/src/oidmap.h b/src/oidmap.h
index d2c451e..2cf208f 100644
--- a/src/oidmap.h
+++ b/src/oidmap.h
@@ -49,4 +49,6 @@ GIT_INLINE(khint_t) git_oidmap_hash(const git_oid *oid)
 
 #define git_oidmap_size(h) kh_size(h)
 
+#define git_oidmap_clear(h) kh_clear(oid, h)
+
 #endif