From mboxrd@z Thu Jan 1 00:00:00 1970 From: john at keeping.me.uk (John Keeping) Date: Sat, 16 Jun 2018 15:23:03 +0100 Subject: [PATCH 07/11] ui-blame: free read_sha1_file() buffer after use In-Reply-To: <152885532551.7253.921107086774301587.stgit@mail.warmcat.com> References: <152885510454.7253.3542488576272033383.stgit@mail.warmcat.com> <152885532551.7253.921107086774301587.stgit@mail.warmcat.com> Message-ID: <20180616142303.GT1922@john.keeping.me.uk> On Wed, Jun 13, 2018 at 10:02:05AM +0800, Andy Green wrote: > Signed-off-by: Andy Green > --- > ui-blame.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/ui-blame.c b/ui-blame.c > index 17e2d60..a5c7d69 100644 > --- a/ui-blame.c > +++ b/ui-blame.c > @@ -206,6 +206,9 @@ static void print_object(const unsigned char *sha1, const char *path, There's an early return above here after allocating buf, I'm not sure if we care about freeing buf on that path as well. If we do, I guess we push free(buf) to the end and add a free_buf label for the error path to jump to. > } else { > html_txt(buf); > } > + > + free(buf); > + > html(""); > > html("\n"); >