smbstatus: Fix CID 1128560 Dereference null return value
authorVolker Lendecke <vl@samba.org>
Wed, 28 Mar 2018 12:22:02 +0000 (07:22 -0500)
committerJeremy Allison <jra@samba.org>
Wed, 28 Mar 2018 22:21:56 +0000 (00:21 +0200)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/utils/status.c

index beae85c4d3e4490faef6ce10baaf73ac7af2944f..6370f7002e8b80b61b6b7f4281b8e64445fe421e 100644 (file)
@@ -528,6 +528,7 @@ int main(int argc, const char *argv[])
        };
        TALLOC_CTX *frame = talloc_stackframe();
        int ret = 0;
+       struct tevent_context *ev;
        struct messaging_context *msg_ctx = NULL;
        char *db_path;
        bool ok;
@@ -618,7 +619,14 @@ int main(int argc, const char *argv[])
         * This implicitly initializes the global ctdbd connection,
         * usable by the db_open() calls further down.
         */
-       msg_ctx = messaging_init(NULL, samba_tevent_context_init(NULL));
+       ev = samba_tevent_context_init(NULL);
+       if (ev == NULL) {
+               fprintf(stderr, "samba_tevent_context_init failed\n");
+               ret = -1;
+               goto done;
+       }
+
+       msg_ctx = messaging_init(NULL, ev);
        if (msg_ctx == NULL) {
                fprintf(stderr, "messaging_init failed\n");
                ret = -1;