Commit 88183c19 by Frank Li

Fix fail clone local repository because can't found object

avoid use object which is already free

Signed-off-by: Frank Li <lznuaa@gmail.com>
parent aa3bf89d
......@@ -318,12 +318,15 @@ static int local_download_pack(
if (!git_object_lookup((git_object**)&commit, t->repo, &oid, GIT_OBJ_COMMIT)) {
const git_oid *tree_oid = git_commit_tree_id(commit);
git_commit_free(commit);
/* Add the commit and its tree */
if ((error = git_packbuilder_insert(pack, &oid, NULL)) < 0 ||
(error = git_packbuilder_insert_tree(pack, tree_oid)) < 0)
(error = git_packbuilder_insert_tree(pack, tree_oid)) < 0) {
git_commit_free(commit);
goto cleanup;
}
git_commit_free(commit);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment