diff --git a/ui-blame.c b/ui-blame.c
index 17e2d60..b118a81 100644
--- a/ui-blame.c
+++ b/ui-blame.c
@@ -154,7 +154,7 @@ static void print_object(const unsigned char *sha1, const char *path,
htmlf("
blob size (%ldKB)"
" exceeds display size limit (%dKB).
",
size / 1024, ctx.cfg.max_blob_size);
- return;
+ goto cleanup;
}
html("\n\n");
@@ -213,6 +213,9 @@ static void print_object(const unsigned char *sha1, const char *path,
html("
\n
\n");
cgit_print_layout_end();
+
+cleanup:
+ free(buf);
}
static int walk_tree(const unsigned char *sha1, struct strbuf *base,