s4:acl LDB module - move a "mem_ctx" creation to the place where it is actually checked
authorMatthias Dieter Wallnöfer <mdw@samba.org>
Wed, 7 Jul 2010 16:01:34 +0000 (18:01 +0200)
committerMatthias Dieter Wallnöfer <mdw@samba.org>
Thu, 8 Jul 2010 17:28:44 +0000 (19:28 +0200)
Memory allocations and their result checks should be as tight as possible.

source4/dsdb/samdb/ldb_modules/acl.c

index 2b0b19c726406cfd8c94a00b28ea5b87110f12a1..39b8e9911fb33f528847c2798904662df5ecee6a 100644 (file)
@@ -129,7 +129,7 @@ static int acl_module_init(struct ldb_module *module)
        struct ldb_context *ldb;
        struct acl_private *data;
        int ret, i;
-       TALLOC_CTX *mem_ctx = talloc_new(module);
+       TALLOC_CTX *mem_ctx;
        static const char *attrs[] = { "passwordAttribute", NULL };
        struct ldb_result *res;
        struct ldb_message *msg;
@@ -154,6 +154,7 @@ static int acl_module_init(struct ldb_module *module)
                                         NULL, "acl", "perform", false);
        ldb_module_set_private(module, data);
 
+       mem_ctx = talloc_new(module);
        if (!mem_ctx) {
                return ldb_oom(ldb);
        }