From e4b8399af6e1ea3530e2e22b83a7416fe52fc404 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 23 Dec 2004 12:02:55 +0000 Subject: r4344: Unify memory handling in dcerpc_samr.c a bit (This used to be commit 79ec28ade826c6a36e129abbe1e0a207074c676f) --- source4/rpc_server/samr/dcesrv_samr.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'source4') diff --git a/source4/rpc_server/samr/dcesrv_samr.c b/source4/rpc_server/samr/dcesrv_samr.c index e838879e60..2e71ad990d 100644 --- a/source4/rpc_server/samr/dcesrv_samr.c +++ b/source4/rpc_server/samr/dcesrv_samr.c @@ -510,7 +510,6 @@ static NTSTATUS samr_CreateDomainGroup(struct dcesrv_call_state *dce_call, TALLO a_state->account_sid = talloc_steal(a_state, sidstr); a_state->account_name = talloc_strdup(a_state, groupname); if (!a_state->account_name) { - talloc_free(a_state); return NT_STATUS_NO_MEMORY; } @@ -693,14 +692,12 @@ static NTSTATUS samr_CreateUser2(struct dcesrv_call_state *dce_call, TALLOC_CTX a_state->account_sid = talloc_steal(a_state, sidstr); a_state->account_name = talloc_strdup(a_state, account_name); if (!a_state->account_name) { - talloc_free(a_state); return NT_STATUS_NO_MEMORY; } /* create the policy handle */ u_handle = dcesrv_handle_new(dce_call->conn, SAMR_HANDLE_USER); if (!u_handle) { - talloc_free(a_state); return NT_STATUS_NO_MEMORY; } @@ -932,9 +929,7 @@ static NTSTATUS samr_CreateDomAlias(struct dcesrv_call_state *dce_call, TALLOC_C a_state->account_dn = talloc_steal(a_state, msg.dn); a_state->account_sid = talloc_steal(a_state, sidstr); a_state->account_name = talloc_strdup(a_state, aliasname); - - if (a_state->account_name == NULL) { - talloc_free(a_state); + if (!a_state->account_name) { return NT_STATUS_NO_MEMORY; } @@ -1119,9 +1114,9 @@ static NTSTATUS samr_OpenGroup(struct dcesrv_call_state *dce_call, TALLOC_CTX *m a_state->access_mask = r->in.access_mask; a_state->domain_state = talloc_reference(a_state, d_state); a_state->account_dn = talloc_steal(a_state, msgs[0]->dn); - a_state->account_sid = talloc_strdup(a_state, sidstr); + a_state->account_sid = talloc_steal(a_state, sidstr); a_state->account_name = talloc_strdup(a_state, groupname); - if (!a_state->account_name || !a_state->account_sid) { + if (!a_state->account_name) { return NT_STATUS_NO_MEMORY; } @@ -1486,10 +1481,10 @@ static NTSTATUS samr_OpenUser(struct dcesrv_call_state *dce_call, TALLOC_CTX *me a_state->sam_ctx = d_state->sam_ctx; a_state->access_mask = r->in.access_mask; a_state->domain_state = talloc_reference(a_state, d_state); - a_state->account_dn = talloc_steal(d_state, msgs[0]->dn); - a_state->account_sid = talloc_strdup(d_state, sidstr); - a_state->account_name = talloc_strdup(d_state, account_name); - if (!a_state->account_name || !a_state->account_sid) { + a_state->account_dn = talloc_steal(a_state, msgs[0]->dn); + a_state->account_sid = talloc_steal(a_state, sidstr); + a_state->account_name = talloc_strdup(a_state, account_name); + if (!a_state->account_name) { return NT_STATUS_NO_MEMORY; } -- cgit