summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <carlosmn@github.com>2016-12-19 17:26:09 +0000
committerGitHub <noreply@github.com>2016-12-19 17:26:09 +0000
commit903955f7e5d81e12ef806636c7c5fbfd6203266c (patch)
treebef6f9d21605fae1546b07ef1d7d8b28b97f5083
parent349016790cedddecbf4c3d3a12daf0fe0018a04f (diff)
parentff5eea06a98182697f16d1335ee331cd8cd1b90c (diff)
downloadlibgit2-903955f7e5d81e12ef806636c7c5fbfd6203266c.tar.gz
Merge pull request #4027 from pks-t/pks/pack-deref-cache-on-error
pack: dereference cached pack entry on error
-rw-r--r--src/pack.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/pack.c b/src/pack.c
index 56de64d57..2e19b3b62 100644
--- a/src/pack.c
+++ b/src/pack.c
@@ -759,8 +759,11 @@ int git_packfile_unpack(
}
cleanup:
- if (error < 0)
+ if (error < 0) {
git__free(obj->data);
+ if (cached)
+ git_atomic_dec(&cached->refcount);
+ }
if (elem)
*obj_offset = curpos;