dovecot-2.0: MODULE_CONTEXT() now returns NULL if the whole modu...
dovecot at dovecot.org
dovecot at dovecot.org
Tue May 11 08:49:46 EEST 2010
details: http://hg.dovecot.org/dovecot-2.0/rev/521e36311440
changeset: 11279:521e36311440
user: Timo Sirainen <tss at iki.fi>
date: Tue May 11 08:49:44 2010 +0300
description:
MODULE_CONTEXT() now returns NULL if the whole module hasn't been registered yet.
This fixes a crash with thread handling.
diffstat:
src/lib/module-context.h | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diffs (15 lines):
diff -r 2ead7574bb08 -r 521e36311440 src/lib/module-context.h
--- a/src/lib/module-context.h Sun May 09 20:57:27 2010 +0000
+++ b/src/lib/module-context.h Tue May 11 08:49:44 2010 +0300
@@ -46,9 +46,10 @@
COMPILE_ERROR_IF_TYPES_NOT_COMPATIBLE(OBJ_REGISTER(obj), (id_ctx).reg)
#define MODULE_CONTEXT(obj, id_ctx) \
+ (unlikely(!(id_ctx).id.module_id_set) ? NULL : \
(*((void **)array_idx_modifiable(&(obj)->module_contexts, \
(id_ctx).id.module_id) + \
- OBJ_REGISTER_COMPATIBLE(obj, id_ctx)))
+ OBJ_REGISTER_COMPATIBLE(obj, id_ctx))))
#ifdef HAVE_TYPEOF
# define MODULE_CONTEXT_DEFINE(_name, _reg) \
More information about the dovecot-cvs
mailing list