From: Pierangelo Masarati Date: Sun, 25 Jul 2004 22:49:24 +0000 (+0000) Subject: import fix to ITS#3256 from HEAD X-Git-Tag: OPENLDAP_REL_ENG_2_2_15~11 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=2b38b8d57bf8bd9ecc9e7e70df3ca0d6709c214b;p=openldap import fix to ITS#3256 from HEAD --- diff --git a/CHANGES b/CHANGES index 385b664ba8..0af72ef1fb 100644 --- a/CHANGES +++ b/CHANGES @@ -24,6 +24,7 @@ OpenLDAP 2.2.15 Engineering Fixed libldap DN '=' handling Fixed libldap_r runqueue bug Updated libldap_r read/writer locks + Fixed librewrite empty rewriteContext leak (ITS#3256) Build environments Added additional res_query detection for MacOS X Added default ldapi:// SSF build setting diff --git a/libraries/librewrite/context.c b/libraries/librewrite/context.c index 03e1e74538..aad9f0a0df 100644 --- a/libraries/librewrite/context.c +++ b/libraries/librewrite/context.c @@ -218,10 +218,10 @@ rewrite_context_apply( assert( op->lo_depth > 0 ); Debug( LDAP_DEBUG_TRACE, "==> rewrite_context_apply" - " [depth=%d] string='%s'\n%s", - op->lo_depth, string, "" ); + " [depth=%d] string='%s'\n", + op->lo_depth, string, 0 ); - s = strdup( string ); + s = (char *)string; for ( rule = context->lc_rule->lr_next; rule != NULL && op->lo_num_passes < info->li_max_passes; @@ -296,7 +296,7 @@ rewrite_context_apply( if ( do_continue ) { if ( rule->lr_next == NULL ) { - res = s; + res = ( s == string ? strdup( s ) : s ); } goto rc_continue; } @@ -321,7 +321,9 @@ rewrite_context_apply( if ( res != NULL ) { struct rewrite_action *action; - free( s ); + if (s != string ) { + free( s ); + } s = res; for ( action = rule->lr_action; @@ -379,7 +381,7 @@ rewrite_context_apply( * result back to the string */ } else if ( rule->lr_next == NULL ) { - res = s; + res = ( s == string ? strdup( s ) : s ); } break;