diff --git a/libraries/libldap/result.c b/libraries/libldap/result.c index acbf51f55f..e9ac9f32b3 100644 --- a/libraries/libldap/result.c +++ b/libraries/libldap/result.c @@ -904,6 +904,13 @@ nextresp2: if ( lr != &dummy_lr ) { ldap_return_request( ld, lr, 1 ); + } else { + if ( lr->lr_res_matched ) { + LDAP_FREE( lr->lr_res_matched ); + } + if ( lr->lr_res_error ) { + LDAP_FREE( lr->lr_res_error ); + } } lr = NULL; }