diff options
| author | Frank Li <lznuaa@gmail.com> | 2013-01-27 13:36:37 +0800 |
|---|---|---|
| committer | Frank Li <lznuaa@gmail.com> | 2013-01-27 13:36:37 +0800 |
| commit | 88183c1988ff1c8b1bbe956e0df6d2c10e5a12b2 (patch) | |
| tree | 1c685e4860b714dc579b8fd6e102e77c3f887931 /src | |
| parent | aa3bf89df21c44f22fe70b4aac9109646fd06b48 (diff) | |
| download | libgit2-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.c | 7 |
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); } } |
