mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-07 10:46:01 +00:00
pack-objects: return early when computing write order fails
The function `compute_write_order` may return a `NULL`-pointer when an error occurs. In such cases we jump to the `done`-label where we try to clean up allocated memory. Unfortunately we try to deallocate the `write_order` array, though, which may be NULL here. Fix this error by returning early instead of jumping to the `done` label. There is no data to be cleaned up anyway.
This commit is contained in:
parent
d1c9a48df6
commit
bac52ab0f2
@ -629,10 +629,8 @@ static int write_pack(git_packbuilder *pb,
|
|||||||
int error = 0;
|
int error = 0;
|
||||||
|
|
||||||
write_order = compute_write_order(pb);
|
write_order = compute_write_order(pb);
|
||||||
if (write_order == NULL) {
|
if (write_order == NULL)
|
||||||
error = -1;
|
return -1;
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Write pack header */
|
/* Write pack header */
|
||||||
ph.hdr_signature = htonl(PACK_SIGNATURE);
|
ph.hdr_signature = htonl(PACK_SIGNATURE);
|
||||||
|
Loading…
Reference in New Issue
Block a user