s4:samldb LDB module - primary group change - free temporary messages to save memory
authorMatthias Dieter Wallnöfer <mdw@samba.org>
Sat, 30 Oct 2010 17:56:24 +0000 (19:56 +0200)
committerMatthias Dieter Wallnöfer <mdw@samba.org>
Sat, 30 Oct 2010 18:23:31 +0000 (20:23 +0200)
source4/dsdb/samdb/ldb_modules/samldb.c

index 44c8fee29f0d91c42b6f36d736092c098d0f831e..b5e8187c7886d5e7a4dd3399113597a6faa14a78 100644 (file)
@@ -1109,7 +1109,7 @@ static int samldb_prim_group_change(struct samldb_ctx *ac)
                }
 
                /* Remove the "member" attribute on the new primary group */
-               msg = talloc_zero(ac, struct ldb_message);
+               msg = ldb_msg_new(ac->msg);
                if (msg == NULL) {
                        return ldb_module_oom(ac->module);
                }
@@ -1125,9 +1125,10 @@ static int samldb_prim_group_change(struct samldb_ctx *ac)
                if (ret != LDB_SUCCESS) {
                        return ret;
                }
+               talloc_free(msg);
 
                /* Add a "member" attribute for the previous primary group */
-               msg = talloc_zero(ac, struct ldb_message);
+               msg = ldb_msg_new(ac->msg);
                if (msg == NULL) {
                        return ldb_module_oom(ac->module);
                }
@@ -1143,6 +1144,7 @@ static int samldb_prim_group_change(struct samldb_ctx *ac)
                if (ret != LDB_SUCCESS) {
                        return ret;
                }
+               talloc_free(msg);
        }
 
        talloc_free(res);