Skip to content

Commit

Permalink
s3:cli_lsarpc: use talloc_zero_array() in dcerpc_lsa_lookup_names_gen…
Browse files Browse the repository at this point in the history
…eric()

It just feels better for such a complex function.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13281

Signed-off-by: Stefan Metzmacher <[email protected]>
Reviewed-by: Ralph Boehme <[email protected]>
Reviewed-by: Andreas Schneider <[email protected]>
  • Loading branch information
metze-samba authored and slowfranklin committed Feb 21, 2018
1 parent 5cae7da commit 569c910
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions source3/rpc_client/cli_lsarpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -638,20 +638,22 @@ NTSTATUS dcerpc_lsa_lookup_names_generic(struct dcerpc_binding_handle *h,
}

if (num_names) {
if (!((*sids = talloc_array(mem_ctx, struct dom_sid, num_names)))) {
*sids = talloc_zero_array(mem_ctx, struct dom_sid, num_names);
if (*sids == NULL) {
DEBUG(0, ("cli_lsa_lookup_sids(): out of memory\n"));
*presult = NT_STATUS_NO_MEMORY;
goto done;
}

if (!((*types = talloc_array(mem_ctx, enum lsa_SidType, num_names)))) {
*types = talloc_zero_array(mem_ctx, enum lsa_SidType, num_names);
if (*types == NULL) {
DEBUG(0, ("cli_lsa_lookup_sids(): out of memory\n"));
*presult = NT_STATUS_NO_MEMORY;
goto done;
}

if (dom_names != NULL) {
*dom_names = talloc_array(mem_ctx, const char *, num_names);
*dom_names = talloc_zero_array(mem_ctx, const char *, num_names);
if (*dom_names == NULL) {
DEBUG(0, ("cli_lsa_lookup_sids(): out of memory\n"));
*presult = NT_STATUS_NO_MEMORY;
Expand Down

0 comments on commit 569c910

Please sign in to comment.