Author: obnox Date: 2007-09-19 11:01:44 +0000 (Wed, 19 Sep 2007) New Revision: 25223
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=25223 Log: Fix behaviour of rpccli_lsa_lookupsids_all() when rpccli_lsa_lookupsids_noalloc() returns an error for one hunk of SIDs: free all allocated arrays and return the error code returned by the hunk lookup. Michael Modified: branches/SAMBA_3_2/source/rpc_client/cli_lsarpc.c branches/SAMBA_3_2_0/source/rpc_client/cli_lsarpc.c Changeset: Modified: branches/SAMBA_3_2/source/rpc_client/cli_lsarpc.c =================================================================== --- branches/SAMBA_3_2/source/rpc_client/cli_lsarpc.c 2007-09-19 09:40:40 UTC (rev 25222) +++ branches/SAMBA_3_2/source/rpc_client/cli_lsarpc.c 2007-09-19 11:01:44 UTC (rev 25223) @@ -259,19 +259,19 @@ if (!((*domains) = TALLOC_ARRAY(mem_ctx, char *, num_sids))) { DEBUG(0, ("rpccli_lsa_lookup_sids_all(): out of memory\n")); result = NT_STATUS_NO_MEMORY; - goto done; + goto fail; } if (!((*names) = TALLOC_ARRAY(mem_ctx, char *, num_sids))) { DEBUG(0, ("rpccli_lsa_lookup_sids_all(): out of memory\n")); result = NT_STATUS_NO_MEMORY; - goto done; + goto fail; } if (!((*types) = TALLOC_ARRAY(mem_ctx, enum lsa_SidType, num_sids))) { DEBUG(0, ("rpccli_lsa_lookup_sids_all(): out of memory\n")); result = NT_STATUS_NO_MEMORY; - goto done; + goto fail; } } else { (*domains) = NULL; @@ -312,7 +312,8 @@ !NT_STATUS_EQUAL(hunk_result, NT_STATUS_NONE_MAPPED)) { /* An actual error occured */ - goto done; + result = hunk_result; + goto fail; } /* adapt overall result */ @@ -333,8 +334,13 @@ hunk_types += hunk_num_sids; } -done: return result; + +fail: + TALLOC_FREE(*domains); + TALLOC_FREE(*names); + TALLOC_FREE(*types); + return result; } /** Lookup a list of sids */ Modified: branches/SAMBA_3_2_0/source/rpc_client/cli_lsarpc.c =================================================================== --- branches/SAMBA_3_2_0/source/rpc_client/cli_lsarpc.c 2007-09-19 09:40:40 UTC (rev 25222) +++ branches/SAMBA_3_2_0/source/rpc_client/cli_lsarpc.c 2007-09-19 11:01:44 UTC (rev 25223) @@ -259,19 +259,19 @@ if (!((*domains) = TALLOC_ARRAY(mem_ctx, char *, num_sids))) { DEBUG(0, ("rpccli_lsa_lookup_sids_all(): out of memory\n")); result = NT_STATUS_NO_MEMORY; - goto done; + goto fail; } if (!((*names) = TALLOC_ARRAY(mem_ctx, char *, num_sids))) { DEBUG(0, ("rpccli_lsa_lookup_sids_all(): out of memory\n")); result = NT_STATUS_NO_MEMORY; - goto done; + goto fail; } if (!((*types) = TALLOC_ARRAY(mem_ctx, enum lsa_SidType, num_sids))) { DEBUG(0, ("rpccli_lsa_lookup_sids_all(): out of memory\n")); result = NT_STATUS_NO_MEMORY; - goto done; + goto fail; } } else { (*domains) = NULL; @@ -312,7 +312,8 @@ !NT_STATUS_EQUAL(hunk_result, NT_STATUS_NONE_MAPPED)) { /* An actual error occured */ - goto done; + result = hunk_result; + goto fail; } /* adapt overall result */ @@ -333,8 +334,13 @@ hunk_types += hunk_num_sids; } -done: return result; + +fail: + TALLOC_FREE(*domains); + TALLOC_FREE(*names); + TALLOC_FREE(*types); + return result; } /** Lookup a list of sids */