r4680: Make more efficient use of memory in SAMR:
authorAndrew Bartlett <abartlet@samba.org>
Tue, 11 Jan 2005 13:59:18 +0000 (13:59 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:08:42 +0000 (13:08 -0500)
 Avoid a strdup, use a talloc_reference
 Use the shortest term memory context possible

Andrew Bartlett

source/rpc_server/samr/dcesrv_samr.c

index 9f0b8d4801c22cba8dbf17f93e6fe4b40948754c..a98fe5ae06314d8b714916a1533dd38a0e701329 100644 (file)
@@ -2391,7 +2391,7 @@ static NTSTATUS samr_OpenUser(struct dcesrv_call_state *dce_call, TALLOC_CTX *me
                return NT_STATUS_INTERNAL_DB_CORRUPTION;
        }
 
-       a_state = talloc_p(d_state, struct samr_account_state);
+       a_state = talloc_p(mem_ctx, struct samr_account_state);
        if (!a_state) {
                return NT_STATUS_NO_MEMORY;
        }
@@ -2649,7 +2649,7 @@ static NTSTATUS samr_SetUserInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX
                return NT_STATUS_NO_MEMORY;
        }
 
-       msg->dn = talloc_strdup(mem_ctx, a_state->account_dn);
+       msg->dn = talloc_reference(mem_ctx, a_state->account_dn);
        if (!msg->dn) {
                return NT_STATUS_NO_MEMORY;
        }