]> git.sur5r.net Git - openldap/commitdiff
don't free before use
authorPierangelo Masarati <ando@openldap.org>
Mon, 12 Apr 2010 16:24:01 +0000 (16:24 +0000)
committerPierangelo Masarati <ando@openldap.org>
Mon, 12 Apr 2010 16:24:01 +0000 (16:24 +0000)
servers/slapd/overlays/rwmmap.c

index 95eec2f92229c7e92ca114740b7b5fca98773546..436ffba7042d7e5b69263695656aff54aae257d9 100644 (file)
@@ -789,9 +789,6 @@ rwm_filter_map_rewrite(
        case REWRITE_REGEXEC_OK:
                if ( !BER_BVISNULL( fstr ) ) {
                        fstr->bv_len = strlen( fstr->bv_val );
-                       if ( fstr->bv_val != ftmp.bv_val ) {
-                               ch_free( ftmp.bv_val );
-                       }
 
                } else {
                        *fstr = ftmp;
@@ -800,6 +797,9 @@ rwm_filter_map_rewrite(
                Debug( LDAP_DEBUG_ARGS,
                        "[rw] %s: \"%s\" -> \"%s\"\n",
                        fdc.ctx, ftmp.bv_val, fstr->bv_val );           
+               if ( fstr->bv_val != ftmp.bv_val ) {
+                       ch_free( ftmp.bv_val );
+               }
                rc = LDAP_SUCCESS;
                break;