The owner-forwarding path re-opens donemailname with O_TRUNC and calls
do_all_the_voodoo_here a second time. If this call fails, the truncated
queue file is left behind. Add unlink(donemailname) and free(donemailname)
to match the cleanup already done at the first call site.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
NULL, &ownerhdrs, NULL, 0) < 0) {
log_error(LOG_ARGS, "do_all_the_voodoo_here");
tll_free_and_free(ownerhdrs, free);
+ close(ownfd);
+ close(rawmailfd);
+ close(donemailfd);
+ unlink(donemailname);
+ free(donemailname);
free_parsed_hdrs(readhdrs, fromemails, originalfromemails,
toemails, ccemails, rpemails, dtemails, allheaders);
exit(EXIT_FAILURE);