more cleanup

This commit is contained in:
Pierangelo Masarati 2002-01-05 18:31:38 +00:00
parent d0261ee534
commit e5beebd6a3

View File

@ -149,7 +149,7 @@ ldap_back_search(
base->bv_val, conn, &mbase.bv_val ) ) { base->bv_val, conn, &mbase.bv_val ) ) {
case REWRITE_REGEXEC_OK: case REWRITE_REGEXEC_OK:
if ( mbase.bv_val == NULL ) { if ( mbase.bv_val == NULL ) {
mbase.bv_val = ( char * )base->bv_val; mbase = *base;
} }
#ifdef NEW_LOGGING #ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1, LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
@ -185,7 +185,10 @@ ldap_back_search(
free( mfilter.bv_val ); free( mfilter.bv_val );
} }
mfilter = *filterstr; mfilter = *filterstr;
} else {
mfilter.bv_len = strlen( mfilter.bv_val );
} }
#ifdef NEW_LOGGING #ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1, LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
"[rw] searchFilter: \"%s\" -> \"%s\"\n", "[rw] searchFilter: \"%s\" -> \"%s\"\n",
@ -223,6 +226,12 @@ ldap_back_search(
#endif /* !ENABLE_REWRITE */ #endif /* !ENABLE_REWRITE */
} }
#ifdef ENABLE_REWRITE
if ( mfilter.bv_val != filterstr->bv_val ) {
ldap_memfree( mfilter.bv_val );
}
#endif /* ENABLE_REWRITE */
mapped_attrs = ldap_back_map_attrs(&li->at_map, attrs, 0); mapped_attrs = ldap_back_map_attrs(&li->at_map, attrs, 0);
if ( mapped_attrs == NULL && attrs) { if ( mapped_attrs == NULL && attrs) {
for (count=0; attrs[count].an_name.bv_val; count++); for (count=0; attrs[count].an_name.bv_val; count++);
@ -341,19 +350,9 @@ finish:;
if ( mapped_attrs ) { if ( mapped_attrs ) {
free( mapped_attrs ); free( mapped_attrs );
} }
#ifdef ENABLE_REWRITE
if ( mapped_filter != mfilter.bv_val ) {
free( mapped_filter );
}
if ( mfilter.bv_val != filterstr->bv_val ) {
free( mfilter.bv_val );
}
#else /* !ENABLE_REWRITE */
if ( mapped_filter != filterstr->bv_val ) { if ( mapped_filter != filterstr->bv_val ) {
free( mapped_filter ); free( mapped_filter );
} }
#endif /* !ENABLE_REWRITE */
if ( mbase.bv_val != base->bv_val ) { if ( mbase.bv_val != base->bv_val ) {
free( mbase.bv_val ); free( mbase.bv_val );
} }