]> git.sur5r.net Git - openldap/commitdiff
Cleanup NULL derefs
authorHoward Chu <hyc@openldap.org>
Fri, 31 Mar 2006 21:18:04 +0000 (21:18 +0000)
committerHoward Chu <hyc@openldap.org>
Fri, 31 Mar 2006 21:18:04 +0000 (21:18 +0000)
libraries/libldap/pagectrl.c
libraries/libldap/sortctrl.c
libraries/libldap/vlvctrl.c

index 40093cb6fd5ed48ead9b6d6d3d8cd16b6a1a9ace..c6f1c4ab7578376f97e05fa17922ae6224219a05 100644 (file)
@@ -65,8 +65,9 @@ ldap_create_page_control_value(
        if ( ld == NULL || value == NULL ||
                pagesize < 1 || pagesize > LDAP_MAXINT )
        {
-               ld->ld_errno = LDAP_PARAM_ERROR;
-               return ld->ld_errno;
+               if ( ld )
+                       ld->ld_errno = LDAP_PARAM_ERROR;
+               return LDAP_PARAM_ERROR;
        }
 
        assert( LDAP_VALID( ld ) );
@@ -195,8 +196,9 @@ ldap_parse_pageresponse_control(
        ber_int_t count;
 
        if ( ld == NULL || ctrl == NULL || cookie == NULL ) {
-               ld->ld_errno = LDAP_PARAM_ERROR;
-               return ld->ld_errno;
+               if ( ld )
+                       ld->ld_errno = LDAP_PARAM_ERROR;
+               return LDAP_PARAM_ERROR;
        }
 
        /* Create a BerElement from the berval returned in the control. */
index 3875387e211e373c72d19ae6aa6f9c9c38070b6d..b4e1f8591ed78ec958cce7ae160e05aef1b7692b 100644 (file)
@@ -297,8 +297,9 @@ ldap_create_sort_control_value(
        ber_tag_t       tag;
 
        if ( ld == NULL || keyList == NULL || value == NULL ) {
-               ld->ld_errno = LDAP_PARAM_ERROR;
-               return ld->ld_errno;
+               if ( ld )
+                       ld->ld_errno = LDAP_PARAM_ERROR;
+               return LDAP_PARAM_ERROR;
        }
 
        assert( LDAP_VALID( ld ) );
@@ -496,8 +497,7 @@ ldap_parse_sortresponse_control(
        ber_len_t berLen;
 
        if (ld == NULL) {
-               ld->ld_errno = LDAP_PARAM_ERROR;
-               return(ld->ld_errno);
+               return LDAP_PARAM_ERROR;
        }
 
        if (ctrl == NULL) {
index ab731007cd14aedb6785247701945a5972170efd..86528c503c010a3807cf63ed9edcf857245460eb 100644 (file)
@@ -95,8 +95,9 @@ ldap_create_vlv_control_value(
        BerElement *ber;
 
        if ( ld == NULL || vlvinfop == NULL || value == NULL ) {
-               ld->ld_errno = LDAP_PARAM_ERROR;
-               return ld->ld_errno;
+               if ( ld )
+                       ld->ld_errno = LDAP_PARAM_ERROR;
+               return LDAP_PARAM_ERROR;
        }
 
        assert( LDAP_VALID( ld ) );