Commit bac52ab0 by Patrick Steinhardt

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.
parent d1c9a48d
......@@ -629,10 +629,8 @@ static int write_pack(git_packbuilder *pb,
int error = 0;
write_order = compute_write_order(pb);
if (write_order == NULL) {
error = -1;
goto done;
}
if (write_order == NULL)
return -1;
/* Write pack header */
ph.hdr_signature = htonl(PACK_SIGNATURE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment