summaryrefslogtreecommitdiff
path: root/builtin/apply.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-03-27 22:14:48 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-03-27 22:40:39 (GMT)
commit5c8774330f5cc7a5e9a4f9e016e06bea6814d8b5 (patch)
treeaa7a9eaeee9ee3498b85dc76a11b72698b7b1f3c /builtin/apply.c
parent2901bbe5be41af3161fe99dede505833f26ff2bf (diff)
downloadgit-5c8774330f5cc7a5e9a4f9e016e06bea6814d8b5.zip
git-5c8774330f5cc7a5e9a4f9e016e06bea6814d8b5.tar.gz
git-5c8774330f5cc7a5e9a4f9e016e06bea6814d8b5.tar.bz2
apply: release memory for fn_table
The fn_table is used to record the result of earlier patch application in case a hand-crafted input file contains multiple patches to the same file. Both its string key (filename) and the contents are borrowed from "struct patch" that represents the previous application in the same apply_patch() call, and they do not leak, but the table itself was not freed properly. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/apply.c')
-rw-r--r--builtin/apply.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/apply.c b/builtin/apply.c
index 04cd8d3..28668c8 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -3724,7 +3724,6 @@ static int apply_patch(int fd, const char *filename, int options)
struct patch *list = NULL, **listp = &list;
int skipped_patch = 0;
- memset(&fn_table, 0, sizeof(struct string_list));
patch_input_file = filename;
read_patch_file(&buf, fd);
offset = 0;
@@ -3791,6 +3790,7 @@ static int apply_patch(int fd, const char *filename, int options)
free_patch_list(list);
strbuf_release(&buf);
+ string_list_clear(&fn_table, 0);
return 0;
}