idmap-hash: Fix Coverity 709118 Dereference before null check
authorVolker Lendecke <vl@samba.org>
Wed, 20 Jun 2012 06:42:20 +0000 (08:42 +0200)
committerMichael Adam <obnox@samba.org>
Wed, 20 Jun 2012 08:51:14 +0000 (10:51 +0200)
Signed-off-by: Michael Adam <obnox@samba.org>
source3/winbindd/idmap_hash/idmap_hash.c

index 1f36b217ef1ebbb19ffee8e5ba8557a30954ca13..e7dd127e148e19e522e84cdfee11e7fe8a2e14d6 100644 (file)
@@ -166,6 +166,11 @@ static NTSTATUS unixids_to_sids(struct idmap_domain *dom,
        NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
        int i;
 
+       if (!ids) {
+               nt_status = NT_STATUS_INVALID_PARAMETER;
+               BAIL_ON_NTSTATUS_ERROR(nt_status);
+       }
+
        /* initialize the status to avoid suprise */
        for (i = 0; ids[i]; i++) {
                ids[i]->status = ID_UNKNOWN;
@@ -174,11 +179,6 @@ static NTSTATUS unixids_to_sids(struct idmap_domain *dom,
        nt_status = be_init(dom);
        BAIL_ON_NTSTATUS_ERROR(nt_status);
 
-       if (!ids) {
-               nt_status = NT_STATUS_INVALID_PARAMETER;
-               BAIL_ON_NTSTATUS_ERROR(nt_status);
-       }
-
        for (i=0; ids[i]; i++) {
                uint32_t h_domain, h_rid;