LDAPControl *const *controls =
(LDAPControl *const *) invalue;
- ldap_controls_free( lo->ldo_sctrls );
+ if( lo->ldo_sctrls )
+ ldap_controls_free( lo->ldo_sctrls );
if( controls == NULL || *controls == NULL ) {
lo->ldo_sctrls = NULL;
LDAPControl *const *controls =
(LDAPControl *const *) invalue;
- ldap_controls_free( lo->ldo_cctrls );
+ if( lo->ldo_cctrls )
+ ldap_controls_free( lo->ldo_cctrls );
if( controls == NULL || *controls == NULL ) {
lo->ldo_cctrls = NULL;
}
#endif
+ if ( ld->ld_options.ldo_sctrls != NULL ) {
+ ldap_controls_free( ld->ld_options.ldo_sctrls );
+ ld->ld_options.ldo_sctrls = NULL;
+ }
+
+ if ( ld->ld_options.ldo_cctrls != NULL ) {
+ ldap_controls_free( ld->ld_options.ldo_cctrls );
+ ld->ld_options.ldo_cctrls = NULL;
+ }
+
ber_sockbuf_free( ld->ld_sb );
#ifdef LDAP_R_COMPILE