Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
builtin/apply.c: fix a memleak
author
Stefan Beller
<sbeller@google.com>
Sat, 21 Mar 2015 00:28:02 +0000
(17:28 -0700)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 23 Mar 2015 18:12:58 +0000
(11:12 -0700)
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>
builtin/apply.c
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
1b7cb89
)
diff --git
a/builtin/apply.c
b/builtin/apply.c
index 65b97eee69d4814bf80f87b1fd6857b8ed80cb90..0769b09287b2bcf6b3f85ff503a396fa245c31a0 100644
(file)
--- a/
builtin/apply.c
+++ b/
builtin/apply.c
@@
-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);