summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFrank Li <lznuaa@gmail.com>2013-01-27 13:36:37 +0800
committerFrank Li <lznuaa@gmail.com>2013-01-27 13:36:37 +0800
commit88183c1988ff1c8b1bbe956e0df6d2c10e5a12b2 (patch)
tree1c685e4860b714dc579b8fd6e102e77c3f887931 /src
parentaa3bf89df21c44f22fe70b4aac9109646fd06b48 (diff)
downloadlibgit2-88183c1988ff1c8b1bbe956e0df6d2c10e5a12b2.tar.gz
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>
Diffstat (limited to 'src')
-rw-r--r--src/transports/local.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/transports/local.c b/src/transports/local.c
index c6e79846e..44431d587 100644
--- a/src/transports/local.c
+++ b/src/transports/local.c
@@ -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);
}
}