From 67c31842b09799b07c25c06bddc181c65349f8fe Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 28 Mar 2018 07:24:01 -0500 Subject: [PATCH] net: Fix CID 1128559 Dereference null return value Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- source3/utils/net.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/source3/utils/net.c b/source3/utils/net.c index bde261670b5..44daa6088ca 100644 --- a/source3/utils/net.c +++ b/source3/utils/net.c @@ -915,6 +915,7 @@ static struct functable net_func[] = { const char **argv_const = discard_const_p(const char *, argv); poptContext pc; TALLOC_CTX *frame = talloc_stackframe(); + struct tevent_context *ev; struct net_context *c = talloc_zero(frame, struct net_context); NTSTATUS status; @@ -1036,9 +1037,12 @@ static struct functable net_func[] = { exit(1); } - status = messaging_init_client(c, - samba_tevent_context_init(c), - &c->msg_ctx); + ev = samba_tevent_context_init(c); + if (ev == NULL) { + d_fprintf(stderr, "samba_tevent_context_init failed\n"); + exit(1); + } + status = messaging_init_client(c, ev, &c->msg_ctx); if (geteuid() != 0 && NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED)) { /*