Skip to content

Commit addcf6c

Browse files
rscharfegitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9752ad0 commit addcf6c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: builtin/fmt-merge-msg.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,8 @@ static void shortlog(const char *name,
376376
string_list_append(&subjects,
377377
oid_to_hex(&commit->object.oid));
378378
else
379-
string_list_append(&subjects, strbuf_detach(&sb, NULL));
379+
string_list_append_nodup(&subjects,
380+
strbuf_detach(&sb, NULL));
380381
}
381382

382383
if (opts->credit_people)

0 commit comments

Comments
 (0)