diff options
author | Junio C Hamano <gitster@pobox.com> | 2023-01-15 00:03:39 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-01-16 10:31:45 -0800 |
commit | 5b8db44bdd619dc5ec4dcdac5cb3ca194ebdd046 (patch) | |
tree | 287f51fe477e9b64bd58961674f1894de9d63294 /commit.c | |
parent | c48035d29b4e524aed3a32f0403676f0d9128863 (diff) |
format-patch: unleak "-v <num>"
The "subject_prefix" member of "struct revision" usually is set to a
borrowed string (either a string literal like "PATCH" that appear in
the program text as a hardcoded default, or the value of
"format.subjectprefix") and is never freed when the containing
revision structure is released. The "-v <num>" codepath however
violates this rule and stores a pointer to an allocated string to
this member, relinquishing the responsibility to free it when it is
done using the revision structure, leading to a small one-time leak.
Instead, keep track of the string it allocates to let the revision
structure borrow, and clean it up when it is done.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit.c')
0 files changed, 0 insertions, 0 deletions