if ( do_continue ) {
if ( rule->lr_next == NULL ) {
- res = ( s == string ? strdup( s ) : s );
+ res = s;
}
goto rc_continue;
}
if ( res != NULL ) {
struct rewrite_action *action;
- if (s != string ) {
+ if ( s != string && s != res ) {
free( s );
}
s = res;
* result back to the string
*/
} else if ( rule->lr_next == NULL ) {
- res = ( s == string ? strdup( s ) : s );
+ res = s;
}
break;
case REWRITE_REGEXEC_UNWILLING:
case REWRITE_REGEXEC_ERR:
if ( *result != NULL ) {
- free( *result );
+ if ( *result != string ) {
+ free( *result );
+ }
*result = NULL;
}
int ldap_syslog;
int ldap_syslog_level;
-char *
+static void
apply(
FILE *fin,
const char *rewriteContext,
rewrite_session_init( info, cookie );
- string = strdup( arg );
+ string = (char *)arg;
for ( sep = strchr( rewriteContext, ',' );
rewriteContext != NULL;
rewriteContext = sep,
- sep ? sep = strchr( rewriteContext, ',' ) : NULL ) {
+ sep ? sep = strchr( rewriteContext, ',' ) : NULL )
+ {
char *errmsg = "";
if ( sep != NULL ) {
if ( result == NULL ) {
break;
}
- free( string );
+ if ( string != arg && string != result ) {
+ free( string );
+ }
string = result;
}
- free( string );
+ if ( result && result != arg ) {
+ free( result );
+ }
rewrite_session_delete( info, cookie );
rewrite_info_delete( &info );
-
- return result;
}
int
op->lo_num_passes++;
if ( regexec( &rule->lr_regex, string, nmatch, match, 0 ) != 0 ) {
- if ( *result == NULL && strcnt > 0 ) {
+ if ( *result == NULL && string != arg ) {
free( string );
- string = NULL;
}
/*
*result = val.bv_val;
val.bv_val = NULL;
- if ( strcnt > 0 ) {
+ if ( string != arg ) {
free( string );
string = NULL;
}
if ( !BER_BVISNULL( out ) ) {
char *val = out->bv_val;
ber_str2bv_x( val, 0, 1, out, ctx );
- free( val );
+ if ( val != in->bv_val ) {
+ free( val );
+ }
} else {
ber_dupbv_x( out, in, ctx );
}