Plug memory leaks - free() controls in LDAP*

This commit is contained in:
Hallvard Furuseth 2005-08-01 03:51:53 +00:00
parent 5c5a834db8
commit f9e505727e
2 changed files with 14 additions and 2 deletions

View File

@ -388,7 +388,8 @@ ldap_set_option(
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;
@ -407,7 +408,8 @@ ldap_set_option(
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;

View File

@ -172,6 +172,16 @@ ldap_ld_free(
}
#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