pthreadpool: let pthreadpool_tevent_job_send() fail with an invalid pool
authorStefan Metzmacher <metze@samba.org>
Fri, 20 Apr 2018 13:07:08 +0000 (15:07 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 12 Jul 2018 12:25:19 +0000 (14:25 +0200)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
lib/pthreadpool/pthreadpool_tevent.c

index db6d4b2..0e890cb 100644 (file)
@@ -301,6 +301,15 @@ struct tevent_req *pthreadpool_tevent_job_send(
        state->fn = fn;
        state->private_data = private_data;
 
+       if (pool == NULL) {
+               tevent_req_error(req, EINVAL);
+               return tevent_req_post(req, ev);
+       }
+       if (pool->pool == NULL) {
+               tevent_req_error(req, EINVAL);
+               return tevent_req_post(req, ev);
+       }
+
        state->im = tevent_create_immediate(state);
        if (tevent_req_nomem(state->im, req)) {
                return tevent_req_post(req, ev);