Use close_text() instead of free() when cleaning up txt in error paths.
The txt parameter is a fully initialized text structure from open_text(),
so it needs proper cleanup via close_text() to free all internal resources.
Also add missing close_text() call when prepstdreply_to() fails.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
if(outfd < 0) {
log_error(LOG_ARGS, "Could not open std mail %s", retstr);
free(retstr);
- free(txt);
+ close_text(txt);
return NULL;
}
if (!prepstdreply_to(txt, ml, from, to, replyto, outfd, NULL)) {
close(outfd);
unlink(retstr);
free(retstr);
+ close_text(txt);
return (NULL);
}
return (retstr);