X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libraries%2Flibrewrite%2Fcontext.c;h=8bf45c60b1abc13d1567b076248a39732455d879;hb=ae471f78c32d7531c729aa88116b8b413cc200bf;hp=aad9f0a0df65f00e6d62e473852047b076fb8062;hpb=9c0ed9b6bd2afccb2118942bd89680a2049742a1;p=openldap diff --git a/libraries/librewrite/context.c b/libraries/librewrite/context.c index aad9f0a0df..8bf45c60b1 100644 --- a/libraries/librewrite/context.c +++ b/libraries/librewrite/context.c @@ -1,7 +1,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * - * Copyright 2000-2004 The OpenLDAP Foundation. + * Copyright 2000-2008 The OpenLDAP Foundation. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -296,7 +296,7 @@ rewrite_context_apply( if ( do_continue ) { if ( rule->lr_next == NULL ) { - res = ( s == string ? strdup( s ) : s ); + res = s; } goto rc_continue; } @@ -321,7 +321,7 @@ rewrite_context_apply( if ( res != NULL ) { struct rewrite_action *action; - if (s != string ) { + if ( s != string && s != res ) { free( s ); } s = res; @@ -381,7 +381,7 @@ rewrite_context_apply( * result back to the string */ } else if ( rule->lr_next == NULL ) { - res = ( s == string ? strdup( s ) : s ); + res = s; } break; @@ -433,7 +433,7 @@ rewrite_context_free( { struct rewrite_context *context = (struct rewrite_context *)tmp; - assert( tmp ); + assert( tmp != NULL ); rewrite_context_destroy( &context ); } @@ -446,12 +446,12 @@ rewrite_context_destroy( struct rewrite_context *context; struct rewrite_rule *r; - assert( pcontext ); - assert( *pcontext ); + assert( pcontext != NULL ); + assert( *pcontext != NULL ); context = *pcontext; - assert( context->lc_rule ); + assert( context->lc_rule != NULL ); for ( r = context->lc_rule->lr_next; r; ) { struct rewrite_rule *cr = r; @@ -463,7 +463,7 @@ rewrite_context_destroy( free( context->lc_rule ); context->lc_rule = NULL; - assert( context->lc_name ); + assert( context->lc_name != NULL ); free( context->lc_name ); context->lc_name = NULL;