Skip to content

Commit 030e293

Browse files
committed
Merge branch 'rs/unpack-entry-leakfix'
Memory leak in an error codepath has been plugged. * rs/unpack-entry-leakfix: sha1_file: release delta_stack on error in unpack_entry()
2 parents 0c49396 + 896dca3 commit 030e293

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

sha1_file.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2542,8 +2542,8 @@ void *unpack_entry(struct packed_git *p, off_t obj_offset,
25422542
error("bad packed object CRC for %s",
25432543
sha1_to_hex(sha1));
25442544
mark_bad_packed_object(p, sha1);
2545-
unuse_pack(&w_curs);
2546-
return NULL;
2545+
data = NULL;
2546+
goto out;
25472547
}
25482548
}
25492549

@@ -2681,6 +2681,7 @@ void *unpack_entry(struct packed_git *p, off_t obj_offset,
26812681
if (final_size)
26822682
*final_size = size;
26832683

2684+
out:
26842685
unuse_pack(&w_curs);
26852686

26862687
if (delta_stack != small_delta_stack)

0 commit comments

Comments
 (0)