From 0d05846dc8837b23edf5944a2c74853b48335954 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Sat, 23 Sep 2006 15:43:55 +0000 Subject: [PATCH] fix potential double free in case of error --- libraries/librewrite/map.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libraries/librewrite/map.c b/libraries/librewrite/map.c index d82729f5ab..0abfd78b91 100644 --- a/libraries/librewrite/map.c +++ b/libraries/librewrite/map.c @@ -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; -- 2.39.5