fmt-merge-msg: avoid leaking strbuf in shortlog()
Use string_list_append_nodup() instead of string_list_append() to hand over ownership of a detached strbuf and thus avoid leaking its memory. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe committed
Dec 7, 2017 at 21:22 UTC
addcf6cfdeb24a2ae589cbdd0ac1e754310b9ca8
1 file changed
+2
-1
builtin/fmt-merge-msg.c
+2
-1
@@ -376,7 +376,8 @@ static void shortlog(const char *name,
376
string_list_append(&subjects,
377
oid_to_hex(&commit->object.oid));
378
else
379
- string_list_append(&subjects, strbuf_detach(&sb, NULL));
379
+ string_list_append_nodup(&subjects,
380
+ strbuf_detach(&sb, NULL));
381
}
382
383
if (opts->credit_people)