Mercurial > dovecot > core-2.2
changeset 11279:521e36311440 HEAD
MODULE_CONTEXT() now returns NULL if the whole module hasn't been registered yet.
This fixes a crash with thread handling.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 11 May 2010 08:49:44 +0300 |
parents | 2ead7574bb08 |
children | 51d0f5d8cc65 |
files | src/lib/module-context.h |
diffstat | 1 files changed, 2 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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) \