Plug leaks

Valgrind is now clean except for libssl and libgcrypt.
This commit is contained in:
Carlos Martín Nieto
2014-11-23 15:51:31 +01:00
parent e06b1040d7
commit f7fcb18f8a
8 changed files with 25 additions and 14 deletions
+3 -6
View File
@@ -12,12 +12,9 @@ git_tree *resolve_commit_oid_to_tree(
git_tree *tree = NULL;
if (git_oid_fromstrn(&oid, partial_oid, len) == 0)
git_object_lookup_prefix(&obj, repo, &oid, len, GIT_OBJ_ANY);
cl_assert(obj);
if (git_object_type(obj) == GIT_OBJ_TREE)
return (git_tree *)obj;
cl_assert(git_object_type(obj) == GIT_OBJ_COMMIT);
cl_git_pass(git_commit_tree(&tree, (git_commit *)obj));
cl_git_pass(git_object_lookup_prefix(&obj, repo, &oid, len, GIT_OBJ_ANY));
cl_git_pass(git_object_peel((git_object **) &tree, obj, GIT_OBJ_TREE));
git_object_free(obj);
return tree;
}