summaryrefslogtreecommitdiff
path: root/builtin/apply.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2012-05-08 14:38:06 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2012-07-09 14:36:26 -0700
commit798b9ce87bfcd18896f9b0e21918b7bf31109b32 (patch)
treec9e99cea15abb3c4ef89bba39d287363d5bd32ae /builtin/apply.c
parentapply: a bit more comments on PATH_TO_BE_DELETED (diff)
downloadtgif-798b9ce87bfcd18896f9b0e21918b7bf31109b32.tar.xz
apply: clear_image() clears things a bit more
The clear_image() function did not clear the line table in the image structure; this does not matter for the current callers, as the function is only called from the codepaths that deal with binary patches where the line table is never populated, and the codepaths that do populate the line table free it themselves. But it will start to matter when we introduce a codepath to retry a failed patch, so make sure it clears and frees everything. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/apply.c')
-rw-r--r--builtin/apply.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin/apply.c b/builtin/apply.c
index 35460c940c..09f5df3b96 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -371,8 +371,8 @@ static void prepare_image(struct image *image, char *buf, size_t len,
static void clear_image(struct image *image)
{
free(image->buf);
- image->buf = NULL;
- image->len = 0;
+ free(image->line_allocated);
+ memset(image, 0, sizeof(*image));
}
/* fmt must contain _one_ %s and no other substitution */