Skip to content

Commit 903955f

Browse files
authored
Merge pull request libgit2#4027 from pks-t/pks/pack-deref-cache-on-error
pack: dereference cached pack entry on error
2 parents 3490167 + ff5eea0 commit 903955f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/pack.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,8 +759,11 @@ int git_packfile_unpack(
759759
}
760760

761761
cleanup:
762-
if (error < 0)
762+
if (error < 0) {
763763
git__free(obj->data);
764+
if (cached)
765+
git_atomic_dec(&cached->refcount);
766+
}
764767

765768
if (elem)
766769
*obj_offset = curpos;

0 commit comments

Comments
 (0)