dovecot-2.2: notify plugin: Don't access already freed memory.

dovecot at dovecot.org dovecot at dovecot.org
Thu Oct 22 13:59:12 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/3d576d682137
changeset: 19330:3d576d682137
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Oct 22 16:59:01 2015 +0300
description:
notify plugin: Don't access already freed memory.
In the same changeset I even added a comment just above that it shouldn't be
accessed..

diffstat:

 src/plugins/notify/notify-storage.c |  3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diffs (20 lines):

diff -r 20b381fd95d0 -r 3d576d682137 src/plugins/notify/notify-storage.c
--- a/src/plugins/notify/notify-storage.c	Thu Oct 22 13:55:27 2015 +0300
+++ b/src/plugins/notify/notify-storage.c	Thu Oct 22 16:59:01 2015 +0300
@@ -178,6 +178,7 @@
 {
 	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 @@
 
 	/* 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;
 }


More information about the dovecot-cvs mailing list