const char *message, *message_short;
git_time_t commit_time;
unsigned int parents, p;
- git_commit *parent;
+ git_commit *parent = NULL, *old_parent = NULL;
git_oid_mkstr(&id, commit_ids[i]);
must_be_true(commit_time > 0);
must_be_true(parents <= 2);
for (p = 0;p < parents;p++) {
+ if (old_parent != NULL)
+ git_commit_close(old_parent);
+
+ old_parent = parent;
must_pass(git_commit_parent(&parent, commit, p));
must_be_true(parent != NULL);
must_be_true(git_commit_author(parent) != NULL); // is it really a commit?
}
+ git_commit_close(old_parent);
+ git_commit_close(parent);
+
must_fail(git_commit_parent(&parent, commit, parents));
+ git_commit_close(commit);
}
git_repository_free(repo);
must_pass(remove_loose_object(REPOSITORY_FOLDER, (git_object *)commit));
+ git_commit_close(commit);
git_repository_free(repo);
END_TEST
must_be_true(git_tree_entry_byindex(tree, 3) == NULL);
must_be_true(git_tree_entry_byindex(tree, -1) == NULL);
+ git_tree_close(tree);
git_repository_free(repo);
END_TEST
/* GH-86: git_object_lookup() should also check the type if the object comes from the cache */
must_be_true(git_object_lookup(&obj, repo, &id, GIT_OBJ_TREE) == 0);
+ git_object_close(obj);
must_be_true(git_object_lookup(&obj, repo, &id, GIT_OBJ_BLOB) == GIT_EINVALIDTYPE);
+ git_object_close(obj);
entry = git_tree_entry_byname(tree, "README");
must_be_true(entry != NULL);
must_pass(git_tree_entry_2object(&obj, repo, entry));
+ git_object_close(obj);
+ git_tree_close(tree);
git_repository_free(repo);
END_TEST
must_pass(git_treebuilder_write(&rid,repo,builder));
must_be_true(git_oid_cmp(&rid, &id2) == 0);
+
+ git_treebuilder_free(builder);
+ git_tree_close(tree);
close_temp_repo(repo);
END_TEST
git__joinpath(ref_name_from_tag_name, GIT_REFS_TAGS_DIR, git_tag_name((git_tag *)object));
must_be_true(strcmp(ref_name_from_tag_name, loose_tag_ref_name) == 0);
+ git_object_close(object);
git_repository_free(repo);
END_TEST
git_oid_mkstr(&id, current_master_tip);
must_be_true(git_oid_cmp(&id, git_object_id(object)) == 0);
+ git_object_close(object);
git_repository_free(repo);
END_TEST
git_oid_mkstr(&id, current_master_tip);
must_be_true(git_oid_cmp(&id, git_object_id(object)) == 0);
+ git_object_close(object);
git_repository_free(repo);
END_TEST
must_be_true(object != NULL);
must_be_true(git_object_type(object) == GIT_OBJ_COMMIT);
+ git_object_close(object);
git_repository_free(repo);
END_TEST