s4:samldb LDB module - "sAMAccountName" checker
authorMatthias Dieter Wallnöfer <mdw@samba.org>
Mon, 1 Nov 2010 11:59:51 +0000 (12:59 +0100)
committerMatthias Dieter Wallnöfer <mdw@samba.org>
Mon, 1 Nov 2010 13:53:25 +0000 (14:53 +0100)
We need a "talloc_steal" for the retrieved "sAMAccountName" since the
memory is afterwards freed using the "talloc_free" call.

source4/dsdb/samdb/ldb_modules/samldb.c

index 43602cec53c9c60680a5ca41829c096d35f03191..7a5beda60bbe8c29a86cf782b8045d78eeea7a26 100644 (file)
@@ -1384,8 +1384,8 @@ static int samldb_sam_accountname_check(struct samldb_ctx *ac)
        if (ret != LDB_SUCCESS) {
                return ret;
        }
-       sam_accountname = ldb_msg_find_attr_as_string(tmp_msg, "sAMAccountName",
-                                                     NULL);
+       sam_accountname = talloc_steal(ac,
+                                      ldb_msg_find_attr_as_string(tmp_msg, "sAMAccountName", NULL));
        talloc_free(tmp_msg);
 
        if (sam_accountname == NULL) {