s3:cli_lsarpc: use talloc_zero_array() in dcerpc_lsa_lookup_sids_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 65c6ca04d50b11a4d48a006cf53fcabebddcf79b..1dce70563856bcafd03a464ac8b9a003da759c57 100644 (file)
@@ -370,19 +370,22 @@ NTSTATUS dcerpc_lsa_lookup_sids_generic(struct dcerpc_binding_handle *h,
        bool have_unmapped = false;
 
        if (num_sids) {
-               if (!(domains = talloc_array(mem_ctx, char *, num_sids))) {
+               domains = talloc_zero_array(mem_ctx, char *, num_sids);
+               if (domains == NULL) {
                        DEBUG(0, ("rpccli_lsa_lookup_sids(): out of memory\n"));
                        status = NT_STATUS_NO_MEMORY;
                        goto fail;
                }
 
-               if (!(names = talloc_array(mem_ctx, char *, num_sids))) {
+               names = talloc_zero_array(mem_ctx, char *, num_sids);
+               if (names == NULL) {
                        DEBUG(0, ("rpccli_lsa_lookup_sids(): out of memory\n"));
                        status = NT_STATUS_NO_MEMORY;
                        goto fail;
                }
 
-               if (!(types = talloc_array(mem_ctx, enum lsa_SidType, num_sids))) {
+               types = talloc_zero_array(mem_ctx, enum lsa_SidType, num_sids);
+               if (types == NULL) {
                        DEBUG(0, ("rpccli_lsa_lookup_sids(): out of memory\n"));
                        status = NT_STATUS_NO_MEMORY;
                        goto fail;