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

2018-06-19 Thread John Keeping
On Tue, Jun 19, 2018 at 05:02:07PM +0800, Andy Green wrote:
> Signed-off-by: Andy Green 

Pushed to jk/for-jason (after rebasing onto master).

> ---
>  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("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 struct object_id *oid, 
> const char *path,
>   html("\n\n");
>  
>   cgit_print_layout_end();
> +
> +cleanup:
> + free(buf);
>  }
>  
>  static int walk_tree(const struct object_id *oid, struct strbuf *base,
___
CGit mailing list
CGit@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/cgit


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

2018-06-19 Thread Andy Green
Signed-off-by: Andy Green 
---
 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("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 struct object_id *oid, const 
char *path,
html("\n\n");
 
cgit_print_layout_end();
+
+cleanup:
+   free(buf);
 }
 
 static int walk_tree(const struct object_id *oid, struct strbuf *base,

___
CGit mailing list
CGit@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/cgit