format-patch: free rev.message_id when exiting
We may allocate a message-id string via gen_message_id(), but we never free it, causing a small leak. This can be demonstrated by running t9001 with a leak-checking build. The offending test is the one touched by3ece9bf0f9
(send-email: clear the $message_id after validation, 2023-05-17), but the leak is much older than that. The test was simply unlucky enough to trigger the leaking code path for the first time. We can fix this by freeing the string at the end of the function. We can also re-mark the test script as leak-free, effectively reverting20bd08aefb
(t9001: mark the script as no longer leak checker clean, 2023-05-17). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
20bd08aefb
commit
cfa120947e
@ -2415,6 +2415,7 @@ done:
|
||||
strbuf_release(&rdiff_title);
|
||||
strbuf_release(&sprefix);
|
||||
free(to_free);
|
||||
free(rev.message_id);
|
||||
if (rev.ref_message_ids)
|
||||
string_list_clear(rev.ref_message_ids, 0);
|
||||
free(rev.ref_message_ids);
|
||||
|
Reference in New Issue
Block a user