From: Junio C Hamano Date: Wed, 06 Sep 2017 19:51:12 GMT Subject: Re: [PATCH 27/34] shortlog: release strbuf after use in insert_one_record() Message-ID: In-Reply-To: <20170830180037.20950-8-l.s.r@web.de> Rene Scharfe writes: > Signed-off-by: Rene Scharfe > --- > builtin/shortlog.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/builtin/shortlog.c b/builtin/shortlog.c > index 43c4799ea9..48af16c681 100644 > --- a/builtin/shortlog.c > +++ b/builtin/shortlog.c > @@ -50,66 +50,67 @@ static int compare_by_list(const void *a1, const void *a2) > static void insert_one_record(struct shortlog *log, > const char *author, > const char *oneline) > { > ... > item = string_list_insert(&log->list, namemailbuf.buf); > + strbuf_release(&namemailbuf); As log->list.strdup_strings is set to true in shortlog_init(), namemailbuf.buf will leak without this. An alterative, as this is the only place we add to log->list, could be to make log->list take ownership of the string by not adding a _release() here but instead _detach(), I guess. It is also curious that at the end of shortlog_output(), we set the log->list.strdup_strings again to true immediately before calling string_list_clear() on it. I suspect that is unnecessary?