mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-06 11:19:47 +00:00
pack: dereference cached pack entry on error
When trying to uncompress deltas in a packfile's delta chain, we try to add object bases to the packfile cache, subsequently decrementing its reference count if it has been added successfully. This may lead to a mismatched reference count in the case where we exit the loop early due to an encountered error. Fix the issue by decrementing the reference count in error cleanup.
This commit is contained in:
parent
8339c66068
commit
ff5eea06a9
@ -757,8 +757,11 @@ int git_packfile_unpack(
|
|||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (error < 0)
|
if (error < 0) {
|
||||||
git__free(obj->data);
|
git__free(obj->data);
|
||||||
|
if (cached)
|
||||||
|
git_atomic_dec(&cached->refcount);
|
||||||
|
}
|
||||||
|
|
||||||
if (elem)
|
if (elem)
|
||||||
*obj_offset = curpos;
|
*obj_offset = curpos;
|
||||||
|
Loading…
Reference in New Issue
Block a user