mirror of
https://github.com/git/git
synced 2024-11-04 16:17:49 +00:00
imap-send: free all_msgs strbuf in "out" label
We read stdin into a strbuf, but most code paths never release it, causing a leak (albeit a minor one, as we leak only when exiting from the main function of the program). Commit56f4f4a29d
(imap-send: minimum leakfix, 2024-06-04) did the minimum to plug the one instance we see in the test suite, when we read an empty input. But it was sufficient only because aside from this noop invocation, we don't test imap-send at all! The right spot to free is in the "out" label, which is hit by all code paths before leaving the function. We couldn't do that in56f4f4a29d
because there was no unified exit path. That came separately in 3aca5f7fb0 (imap-send: fix leaking memory in `imap_server_conf`, 2024-06-04), which cleaned up many other leaks (but not this one). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
f5598fcb7b
commit
e3d2364c45
1 changed files with 1 additions and 1 deletions
|
@ -1555,7 +1555,6 @@ int cmd_main(int argc, const char **argv)
|
|||
}
|
||||
|
||||
if (all_msgs.len == 0) {
|
||||
strbuf_release(&all_msgs);
|
||||
fprintf(stderr, "nothing to send\n");
|
||||
ret = 1;
|
||||
goto out;
|
||||
|
@ -1586,5 +1585,6 @@ int cmd_main(int argc, const char **argv)
|
|||
free(server.user);
|
||||
free(server.pass);
|
||||
free(server.auth_method);
|
||||
strbuf_release(&all_msgs);
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue