]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
notify plugin: Don't access already freed memory.
authorTimo Sirainen <tss@iki.fi>
Thu, 22 Oct 2015 13:59:01 +0000 (16:59 +0300)
committerTimo Sirainen <tss@iki.fi>
Thu, 22 Oct 2015 13:59:01 +0000 (16:59 +0300)
In the same changeset I even added a comment just above that it shouldn't be
accessed..

src/plugins/notify/notify-storage.c

index 22175e1e76372307af3d7e406bfce0b41cdac325..eb0b8b24a3d5bba05d3563778d2b952e755f0f43 100644 (file)
@@ -178,6 +178,7 @@ notify_transaction_commit(struct mailbox_transaction_context *t,
 {
        struct notify_transaction_context *lt = NOTIFY_CONTEXT(t);
        union mailbox_module_context *lbox = NOTIFY_CONTEXT(t->box);
+       bool no_notify = (t->flags & MAILBOX_TRANSACTION_FLAG_NO_NOTIFY) != 0;
 
        if (lt->tmp_mail != NULL)
                mail_free(&lt->tmp_mail);
@@ -190,7 +191,7 @@ notify_transaction_commit(struct mailbox_transaction_context *t,
 
        /* FIXME: note that t is already freed at this stage. it's not actually
           being dereferenced anymore though. still, a bit unsafe.. */
-       if ((t->flags & MAILBOX_TRANSACTION_FLAG_NO_NOTIFY) == 0)
+       if (!no_notify)
                notify_contexts_mail_transaction_commit(t, changes_r);
        return 0;
 }