s3:cli_lsarpc: use talloc_zero_array() in dcerpc_lsa_lookup_names_generic()
authorStefan Metzmacher <metze@samba.org>
Fri, 2 Feb 2018 11:07:11 +0000 (12:07 +0100)
committerRalph Boehme <slow@samba.org>
Wed, 21 Feb 2018 13:19:17 +0000 (14:19 +0100)
It just feels better for such a complex function.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/rpc_client/cli_lsarpc.c

index 1dce70563856bcafd03a464ac8b9a003da759c57..a093ee2572c9c36be86be3a17954ba9717b2f893 100644 (file)
@@ -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;