[PATCH v3 08/17] ui-blame: free read_sha1_file() buffer after use

Andy Green andy at warmcat.com
Tue Jun 19 11:02:07 CEST 2018


Signed-off-by: Andy Green <andy at warmcat.com>
---
 ui-blame.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/ui-blame.c b/ui-blame.c
index 8b56554..37e2c68 100644
--- a/ui-blame.c
+++ b/ui-blame.c
@@ -154,7 +154,7 @@ static void print_object(const struct object_id *oid, const char *path,
 		htmlf("<div class='error'>blob size (%ldKB)"
 		      " exceeds display size limit (%dKB).</div>",
 		      size / 1024, ctx.cfg.max_blob_size);
-		return;
+		goto cleanup;
 	}
 
 	html("<table class='blame blob'>\n<tr>\n");
@@ -213,6 +213,9 @@ static void print_object(const struct object_id *oid, const char *path,
 	html("</tr>\n</table>\n");
 
 	cgit_print_layout_end();
+
+cleanup:
+	free(buf);
 }
 
 static int walk_tree(const struct object_id *oid, struct strbuf *base,



More information about the CGit mailing list