From addcf6cfdeb24a2ae589cbdd0ac1e754310b9ca8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Thu, 7 Dec 2017 21:22:49 +0100 Subject: 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 Signed-off-by: Junio C Hamano diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c index efab62f..578a0a2 100644 --- a/builtin/fmt-merge-msg.c +++ b/builtin/fmt-merge-msg.c @@ -376,7 +376,8 @@ static void shortlog(const char *name, string_list_append(&subjects, oid_to_hex(&commit->object.oid)); else - string_list_append(&subjects, strbuf_detach(&sb, NULL)); + string_list_append_nodup(&subjects, + strbuf_detach(&sb, NULL)); } if (opts->credit_people) -- cgit v0.10.2-6-g49f6