From 569c910b950df24b22777c545fe9f6427a19b035 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 2 Feb 2018 12:07:11 +0100 Subject: s3:cli_lsarpc: use talloc_zero_array() in dcerpc_lsa_lookup_names_generic() It just feels better for such a complex function. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13281 Signed-off-by: Stefan Metzmacher Reviewed-by: Ralph Boehme Reviewed-by: Andreas Schneider --- source3/rpc_client/cli_lsarpc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source3/rpc_client/cli_lsarpc.c b/source3/rpc_client/cli_lsarpc.c index 1dce7056385..a093ee2572c 100644 --- a/source3/rpc_client/cli_lsarpc.c +++ b/source3/rpc_client/cli_lsarpc.c @@ -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; -- cgit v1.2.1