]> git.sur5r.net Git - openldap/blobdiff - libraries/librewrite/context.c
ITS#5360 move tls option setup
[openldap] / libraries / librewrite / context.c
index 03e1e745381b93e84ebc4bf6b757b07450cee74a..8bf45c60b1abc13d1567b076248a39732455d879 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * 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
@@ -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;
@@ -321,7 +321,9 @@ rewrite_context_apply(
                        if ( res != NULL ) {
                                struct rewrite_action *action;
                                
-                               free( s );
+                               if ( s != string && s != res ) {
+                                       free( s );
+                               }
                                s = res;
 
                                for ( action = rule->lr_action;
@@ -431,7 +433,7 @@ rewrite_context_free(
 {
        struct rewrite_context *context = (struct rewrite_context *)tmp;
 
-       assert( tmp );
+       assert( tmp != NULL );
 
        rewrite_context_destroy( &context );
 }
@@ -444,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;
@@ -461,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;