From 2d4da0b23ccec61d3470ad9ed0b1f01f6699ab58 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Fri, 31 Mar 2006 21:18:04 +0000 Subject: [PATCH] Cleanup NULL derefs --- libraries/libldap/pagectrl.c | 10 ++++++---- libraries/libldap/sortctrl.c | 8 ++++---- libraries/libldap/vlvctrl.c | 5 +++-- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/libraries/libldap/pagectrl.c b/libraries/libldap/pagectrl.c index 40093cb6fd..c6f1c4ab75 100644 --- a/libraries/libldap/pagectrl.c +++ b/libraries/libldap/pagectrl.c @@ -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. */ diff --git a/libraries/libldap/sortctrl.c b/libraries/libldap/sortctrl.c index 3875387e21..b4e1f8591e 100644 --- a/libraries/libldap/sortctrl.c +++ b/libraries/libldap/sortctrl.c @@ -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) { diff --git a/libraries/libldap/vlvctrl.c b/libraries/libldap/vlvctrl.c index ab731007cd..86528c503c 100644 --- a/libraries/libldap/vlvctrl.c +++ b/libraries/libldap/vlvctrl.c @@ -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 ) ); -- 2.39.5