r14280: Fix Coverity #129 and 130: check before dereferencing a pointer. This
authorJim McDonough <jmcd@samba.org>
Mon, 13 Mar 2006 01:49:01 +0000 (01:49 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:15:23 +0000 (11:15 -0500)
was especially silly as we checked immediately _after_ dereferencing it
:-/

source/lib/secdesc.c

index 11f963fa0e86da4b9ea0ad64af2810de8570ecce..f8873277cf87ff5bccc7112a85bfc3fc495a265d 100644 (file)
@@ -336,11 +336,11 @@ NTSTATUS sec_desc_add_sid(TALLOC_CTX *ctx, SEC_DESC **psd, DOM_SID *sid, uint32
        SEC_ACE  *ace  = 0;
        NTSTATUS  status;
 
-       *sd_size = 0;
-
        if (!ctx || !psd || !sid || !sd_size)
                return NT_STATUS_INVALID_PARAMETER;
 
+       *sd_size = 0;
+
        status = sec_ace_add_sid(ctx, &ace, psd[0]->dacl->ace, &psd[0]->dacl->num_aces, sid, mask);
        
        if (!NT_STATUS_IS_OK(status))
@@ -388,11 +388,11 @@ NTSTATUS sec_desc_del_sid(TALLOC_CTX *ctx, SEC_DESC **psd, DOM_SID *sid, size_t
        SEC_ACE  *ace  = 0;
        NTSTATUS  status;
 
-       *sd_size = 0;
-       
        if (!ctx || !psd[0] || !sid || !sd_size)
                return NT_STATUS_INVALID_PARAMETER;
 
+       *sd_size = 0;
+       
        status = sec_ace_del_sid(ctx, &ace, psd[0]->dacl->ace, &psd[0]->dacl->num_aces, sid);
 
        if (!NT_STATUS_IS_OK(status))