fmt-merge-msg: avoid leaking strbuf in shortlog()
authorRené Scharfe <l.s.r@web.de>
Thu, 7 Dec 2017 20:22:49 +0000 (21:22 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 7 Dec 2017 20:34:35 +0000 (12:34 -0800)
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>
builtin/fmt-merge-msg.c
index efab62fd85e314ccb6ec5becedead91823d03dde..578a0a20e1e7248f916e0fe847481ff70c18187d 100644 (file)
@@ -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)