From: Stefan Metzmacher Date: Fri, 2 Feb 2018 11:07:11 +0000 (+0100) Subject: s3:cli_lsarpc: use talloc_zero_array() in dcerpc_lsa_lookup_names_generic() X-Git-Tag: tevent-0.9.36~49 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=569c910b950df24b22777c545fe9f6427a19b035;p=thirdparty%2Fsamba.git 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 --- 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;