summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2017-12-07 20:22:49 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-12-07 20:34:35 (GMT)
commitaddcf6cfdeb24a2ae589cbdd0ac1e754310b9ca8 (patch)
tree5afdeb850417b4bfc779d1996e809e932150b117 /builtin
parent9752ad0bb79f680bca48db7adc45338b298304b0 (diff)
downloadgit-addcf6cfdeb24a2ae589cbdd0ac1e754310b9ca8.zip
git-addcf6cfdeb24a2ae589cbdd0ac1e754310b9ca8.tar.gz
git-addcf6cfdeb24a2ae589cbdd0ac1e754310b9ca8.tar.bz2
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>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/fmt-merge-msg.c3
1 files changed, 2 insertions, 1 deletions
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)