tevent: fix CID 1437976 dereference before null check
authorRalph Boehme <slow@samba.org>
Tue, 17 Jul 2018 10:54:29 +0000 (12:54 +0200)
committerVolker Lendecke <vl@samba.org>
Tue, 17 Jul 2018 11:33:06 +0000 (13:33 +0200)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
lib/tevent/tevent_threads.c

index 21a9b686ba91a96683905e57620d084e22361678..a89990f231a468a818189907115020980fac0b93 100644 (file)
@@ -473,7 +473,7 @@ void _tevent_threaded_schedule_immediate(struct tevent_threaded_context *tctx,
 #ifdef HAVE_PTHREAD
        const char *create_location = im->create_location;
        struct tevent_context *main_ev = NULL;
-       struct tevent_wrapper_glue *glue = tctx->event_ctx->wrapper.glue;
+       struct tevent_wrapper_glue *glue = NULL;
        int ret, wakeup_fd;
 
        ret = pthread_mutex_lock(&tctx->event_ctx_mutex);
@@ -492,6 +492,8 @@ void _tevent_threaded_schedule_immediate(struct tevent_threaded_context *tctx,
                return;
        }
 
+       glue = tctx->event_ctx->wrapper.glue;
+
        if ((im->event_ctx != NULL) || (handler == NULL)) {
                abort();
        }