]> git.ipfire.org Git - thirdparty/mlmmj.git/commitdiff
mlmmj-process: clean up queue file on second do_all_the_voodoo_here failure 86/head
authorMichael S. Tsirkin <mst@redhat.com>
Sun, 8 Feb 2026 22:24:33 +0000 (17:24 -0500)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 17 Feb 2026 15:17:11 +0000 (10:17 -0500)
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>
src/mlmmj-process.c

index c04943ee8d91e996d352410e18e34760918a92e6..c7de1de7914d9ce8894ba6523d86bcc006ea6a2e 100644 (file)
@@ -545,6 +545,11 @@ int main(int argc, char **argv)
                                        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);