ldb:common/*.c - check for some OOM conditions
authorMatthias Dieter Wallnöfer <mdw@samba.org>
Mon, 4 Apr 2011 08:26:47 +0000 (10:26 +0200)
committerMatthias Dieter Wallnöfer <mdw@samba.org>
Thu, 7 Apr 2011 13:53:20 +0000 (15:53 +0200)
Reviewed-by: abartlet
source4/lib/ldb/common/ldb.c
source4/lib/ldb/common/ldb_modules.c

index d902482de060182e299902d6c03ea778e06b1579..0aadeb0d30fd3a936d54e6db05bb88677d75e77c 100644 (file)
@@ -104,6 +104,10 @@ struct ldb_context *ldb_init(TALLOC_CTX *mem_ctx, struct tevent_context *ev_ctx)
        }
 
        ldb = talloc_zero(mem_ctx, struct ldb_context);
+       if (ldb == NULL) {
+               return NULL;
+       }
+
        /* A new event context so that callers who don't want ldb
         * operating on thier global event context can work without
         * having to provide their own private one explicitly */
index b382a91ec8e45e2662303b1452776318b68a492c..d07666a67450637fd2cd0745336e4d7920d0448a 100644 (file)
@@ -200,6 +200,9 @@ int ldb_module_connect_backend(struct ldb_context *ldb,
                /* Default to tdb */
                backend = talloc_strdup(ldb, "tdb");
        }
+       if (backend == NULL) {
+               return ldb_oom(ldb);
+       }
 
        be = ldb_find_backend(backend);