From: Stefan Metzmacher Date: Mon, 3 Jan 2005 14:45:17 +0000 (+0000) Subject: r4508: - simplify the code and allocate only in one place X-Git-Tag: samba-4.0.0alpha6~801^3~12084 X-Git-Url: http://git.samba.org/?p=samba.git;a=commitdiff_plain;h=4dd48e95cdd40d0d489253f51363aff7916aed9a r4508: - simplify the code and allocate only in one place - the ZERO_STRUCT(r->out) is useless and wrong if we would have a [ref,out] parameter also note the r->out is already initialized by the pidl generated code metze (This used to be commit 09727d3d4acdc90165f37ef726ba6f6ef6f77b98) --- diff --git a/source4/rpc_server/dssetup/dcesrv_dssetup.c b/source4/rpc_server/dssetup/dcesrv_dssetup.c index e3c33cc5534..64f67b28f91 100644 --- a/source4/rpc_server/dssetup/dcesrv_dssetup.c +++ b/source4/rpc_server/dssetup/dcesrv_dssetup.c @@ -33,7 +33,10 @@ static WERROR dssetup_DsRoleGetPrimaryDomainInformation(struct dcesrv_call_state TALLOC_CTX *mem_ctx, struct dssetup_DsRoleGetPrimaryDomainInformation *r) { - ZERO_STRUCT(r->out); + union dssetup_DsRoleInfo *info; + + info = talloc_p(mem_ctx, union dssetup_DsRoleInfo); + W_ERROR_HAVE_NO_MEMORY(info); switch (r->in.level) { case DS_ROLE_BASIC_INFORMATION: @@ -42,7 +45,6 @@ static WERROR dssetup_DsRoleGetPrimaryDomainInformation(struct dcesrv_call_state const char * const attrs[] = { "dnsDomain", "nTMixedDomain", "objectGUID", "name", NULL }; int ret; struct ldb_message **res; - union dssetup_DsRoleInfo *info; enum dssetup_DsRole role = DS_ROLE_STANDALONE_SERVER; uint32 flags = 0; const char *domain = NULL; @@ -52,9 +54,6 @@ static WERROR dssetup_DsRoleGetPrimaryDomainInformation(struct dcesrv_call_state ZERO_STRUCT(domain_guid); - info = talloc_p(mem_ctx, union dssetup_DsRoleInfo); - W_ERROR_HAVE_NO_MEMORY(info); - switch (lp_server_role()) { case ROLE_STANDALONE: role = DS_ROLE_STANDALONE_SERVER; @@ -120,11 +119,6 @@ static WERROR dssetup_DsRoleGetPrimaryDomainInformation(struct dcesrv_call_state } case DS_ROLE_UPGRADE_STATUS: { - union dssetup_DsRoleInfo *info; - - info = talloc_p(mem_ctx, union dssetup_DsRoleInfo); - W_ERROR_HAVE_NO_MEMORY(info); - info->upgrade.upgrading = DS_ROLE_NOT_UPGRADING; info->upgrade.previous_role = DS_ROLE_PREVIOUS_UNKNOWN; @@ -133,11 +127,6 @@ static WERROR dssetup_DsRoleGetPrimaryDomainInformation(struct dcesrv_call_state } case DS_ROLE_OP_STATUS: { - union dssetup_DsRoleInfo *info; - - info = talloc_p(mem_ctx, union dssetup_DsRoleInfo); - W_ERROR_HAVE_NO_MEMORY(info); - info->opstatus.status = DS_ROLE_OP_IDLE; r->out.info = info;