apply: clear_image() clears things a bit more
[gitweb.git] / builtin / apply.c
index 35460c940c5082b2c9369038d131d0582c406331..09f5df3b963cf1c98860544229dd7a694e80f538 100644 (file)
@@ -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 */