]> git.sur5r.net Git - openldap/commitdiff
fix potential double free in case of error
authorPierangelo Masarati <ando@openldap.org>
Sat, 23 Sep 2006 15:43:55 +0000 (15:43 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sat, 23 Sep 2006 15:43:55 +0000 (15:43 +0000)
libraries/librewrite/map.c

index d82729f5abe70c8bd8861bb1bf2f3bc320c34f50..0abfd78b91906702ec9abc5dff79e9405c4f6ac6 100644 (file)
@@ -354,7 +354,12 @@ rewrite_map_apply(
                                ( struct rewrite_context * )map->lm_data,
                                key->bv_val, &val->bv_val );
                if ( val->bv_val != NULL ) {
-                       val->bv_len = strlen( val->bv_val );
+                       if ( val->bv_val = key->bv_val ) {
+                               val->bv_len = key->bv_len;
+                               key->bv_val = NULL;
+                       } else {
+                               val->bv_len = strlen( val->bv_val );
+                       }
                }
                break;