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;