s4:objectclass LDB module - "add" operation - free "mem_ctx" as soon as possible
authorMatthias Dieter Wallnöfer <mdw@samba.org>
Thu, 5 Aug 2010 18:59:56 +0000 (20:59 +0200)
committerMatthias Dieter Wallnöfer <mdw@samba.org>
Sat, 7 Aug 2010 12:22:41 +0000 (14:22 +0200)
We don't need to have it around until the end of the function.

source4/dsdb/samdb/ldb_modules/objectclass.c

index 44d8889dd50f56fe2a7fee67c35d9bef02681ab9..a3fa39e80a65fc45f09cdf26bb4016d6810e4f31 100644 (file)
@@ -537,6 +537,8 @@ static int objectclass_do_add(struct oc_context *ac)
                        }
                }
 
+               talloc_free(mem_ctx);
+
                /* Retrive the message again so get_last_structural_class works */
                objectclass_element = ldb_msg_find_element(msg, "objectClass");
 
@@ -606,7 +608,6 @@ static int objectclass_do_add(struct oc_context *ac)
                                value = talloc_strdup(msg, objectclass->defaultObjectCategory);
                        }
                        if (value == NULL) {
-                               talloc_free(mem_ctx);
                                return ldb_oom(ldb);
                        }
                        ldb_msg_add_string(msg, "objectCategory", value);
@@ -651,11 +652,8 @@ static int objectclass_do_add(struct oc_context *ac)
                        samdb_msg_add_int(ldb, msg, msg, "systemFlags", systemFlags);
                }
        }
-
-       talloc_free(mem_ctx);
        ret = ldb_msg_sanity_check(ldb, msg);
 
-
        if (ret != LDB_SUCCESS) {
                return ret;
        }