mirror of
https://github.com/git/git
synced 2024-08-28 12:09:19 +00:00
builtin/apply.c: fix a memleak
oldlines is allocated earlier in the function and also freed on the successful code path. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
1b7cb8969c
commit
f0b1f1ece7
|
@ -2776,7 +2776,8 @@ static int apply_one_fragment(struct image *img, struct fragment *frag,
|
|||
default:
|
||||
if (apply_verbosely)
|
||||
error(_("invalid start of line: '%c'"), first);
|
||||
return -1;
|
||||
applied_pos = -1;
|
||||
goto out;
|
||||
}
|
||||
if (added_blank_line) {
|
||||
if (!new_blank_lines_at_end)
|
||||
|
@ -2915,6 +2916,7 @@ static int apply_one_fragment(struct image *img, struct fragment *frag,
|
|||
(int)(old - oldlines), oldlines);
|
||||
}
|
||||
|
||||
out:
|
||||
free(oldlines);
|
||||
strbuf_release(&newlines);
|
||||
free(preimage.line_allocated);
|
||||
|
|
Loading…
Reference in a new issue