ldb: Fix 1138330 Dereference null return value
authorVolker Lendecke <vl@samba.org>
Sun, 15 Dec 2013 20:23:59 +0000 (21:23 +0100)
committerJeremy Allison <jra@samba.org>
Tue, 17 Dec 2013 00:57:13 +0000 (01:57 +0100)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
lib/ldb/common/ldb.c

index d2b873f0b516f9e56a86ff8fd95d424ec58a3df8..e5fa81977a7e87824466f23a027b44732d051a15 100644 (file)
@@ -112,6 +112,10 @@ struct ldb_context *ldb_init(TALLOC_CTX *mem_ctx, struct tevent_context *ev_ctx)
         * having to provide their own private one explicitly */
        if (ev_ctx == NULL) {
                ev_ctx = tevent_context_init(ldb);
+               if (ev_ctx == NULL) {
+                       talloc_free(ldb);
+                       return NULL;
+               }
                tevent_set_debug(ev_ctx, ldb_tevent_debug, ldb);
                tevent_loop_allow_nesting(ev_ctx);
        }