mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-06 10:46:21 +08:00
fix leak when the rewriteContext is disabled (ITS#3256)
This commit is contained in:
parent
d9927adf88
commit
9c0ed9b6bd
@ -218,10 +218,10 @@ rewrite_context_apply(
|
|||||||
assert( op->lo_depth > 0 );
|
assert( op->lo_depth > 0 );
|
||||||
|
|
||||||
Debug( LDAP_DEBUG_TRACE, "==> rewrite_context_apply"
|
Debug( LDAP_DEBUG_TRACE, "==> rewrite_context_apply"
|
||||||
" [depth=%d] string='%s'\n%s",
|
" [depth=%d] string='%s'\n",
|
||||||
op->lo_depth, string, "" );
|
op->lo_depth, string, 0 );
|
||||||
|
|
||||||
s = strdup( string );
|
s = (char *)string;
|
||||||
|
|
||||||
for ( rule = context->lc_rule->lr_next;
|
for ( rule = context->lc_rule->lr_next;
|
||||||
rule != NULL && op->lo_num_passes < info->li_max_passes;
|
rule != NULL && op->lo_num_passes < info->li_max_passes;
|
||||||
@ -296,7 +296,7 @@ rewrite_context_apply(
|
|||||||
|
|
||||||
if ( do_continue ) {
|
if ( do_continue ) {
|
||||||
if ( rule->lr_next == NULL ) {
|
if ( rule->lr_next == NULL ) {
|
||||||
res = s;
|
res = ( s == string ? strdup( s ) : s );
|
||||||
}
|
}
|
||||||
goto rc_continue;
|
goto rc_continue;
|
||||||
}
|
}
|
||||||
@ -321,7 +321,9 @@ rewrite_context_apply(
|
|||||||
if ( res != NULL ) {
|
if ( res != NULL ) {
|
||||||
struct rewrite_action *action;
|
struct rewrite_action *action;
|
||||||
|
|
||||||
free( s );
|
if (s != string ) {
|
||||||
|
free( s );
|
||||||
|
}
|
||||||
s = res;
|
s = res;
|
||||||
|
|
||||||
for ( action = rule->lr_action;
|
for ( action = rule->lr_action;
|
||||||
@ -379,7 +381,7 @@ rewrite_context_apply(
|
|||||||
* result back to the string
|
* result back to the string
|
||||||
*/
|
*/
|
||||||
} else if ( rule->lr_next == NULL ) {
|
} else if ( rule->lr_next == NULL ) {
|
||||||
res = s;
|
res = ( s == string ? strdup( s ) : s );
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user