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 */