]> git.ipfire.org Git - thirdparty/mlmmj.git/commitdiff
listcontrol: fix double-free in CTRL_RELEASE error path
authorMichael S. Tsirkin <mst@redhat.com>
Thu, 8 Jan 2026 06:49:01 +0000 (01:49 -0500)
committerMichael S. Tsirkin <mst@redhat.com>
Fri, 9 Jan 2026 12:16:16 +0000 (07:16 -0500)
moderatefilename is already freed before the autosubscribe block:

free(moderatefilename);
bool autosubscribe = statctrl(ml->ctrlfd, "autosubscribe");
if (autosubscribe) {
...
if (mfd == -1) {
free(sendfilename);
free(moderatefilename);  // double-free
return (-1);
}

Remove the second free.

Fixes: ac7f7646 ("autosubscribe: new feature")
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
src/listcontrol.c

index 139898c84aee07af957e1c2191e3e4d2b4a2134f..2d4927d0bf84d68e5324a2f51f9d702f994df997 100644 (file)
@@ -442,7 +442,6 @@ int listcontrol(strlist *fromemails, struct ml *ml, const char *controlstr,
                        int mfd = openat(ml->fd, sendfilename, O_RDONLY);
                        if (mfd == -1) {
                                free(sendfilename);
-                               free(moderatefilename);
                                return (-1);
                        }
                        autosubscribe_sender(ml, mfd, SUB_NOMAIL);