]> git.cameronkatri.com Git - cgit.git/commitdiff
ui-blame: free read_sha1_file() buffer after use
authorAndy Green <andy@warmcat.com>
Tue, 19 Jun 2018 09:02:07 +0000 (17:02 +0800)
committerJohn Keeping <john@keeping.me.uk>
Tue, 19 Jun 2018 21:45:09 +0000 (22:45 +0100)
Signed-off-by: Andy Green <andy@warmcat.com>
Signed-off-by: John Keeping <john@keeping.me.uk>
ui-blame.c

index 17e2d60dc6981d486cd8bde05a081eb80d74578c..b118a81521a5d0a11f45ca3e58edc19988691212 100644 (file)
@@ -154,7 +154,7 @@ static void print_object(const unsigned char *sha1, const char *path,
                htmlf("<div class='error'>blob size (%ldKB)"
                      " exceeds display size limit (%dKB).</div>",
                      size / 1024, ctx.cfg.max_blob_size);
                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");
        }
 
        html("<table class='blame blob'>\n<tr>\n");
@@ -213,6 +213,9 @@ static void print_object(const unsigned char *sha1, const char *path,
        html("</tr>\n</table>\n");
 
        cgit_print_layout_end();
        html("</tr>\n</table>\n");
 
        cgit_print_layout_end();
+
+cleanup:
+       free(buf);
 }
 
 static int walk_tree(const unsigned char *sha1, struct strbuf *base,
 }
 
 static int walk_tree(const unsigned char *sha1, struct strbuf *base,