From: Martin Willi Date: Thu, 3 Feb 2011 15:58:12 +0000 (+0100) Subject: Replace hashtable key if a put operation replaces value X-Git-Tag: 4.5.1~74 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e0eae49857e462e48fceda6e186a1a60624f43d;p=thirdparty%2Fstrongswan.git Replace hashtable key if a put operation replaces value Fixes a crash if lifetime of key is bound to value (i.e. key == value) --- diff --git a/src/libstrongswan/utils/hashtable.c b/src/libstrongswan/utils/hashtable.c index 3b7148e0be..49b0bb68c8 100644 --- a/src/libstrongswan/utils/hashtable.c +++ b/src/libstrongswan/utils/hashtable.c @@ -249,6 +249,7 @@ METHOD(hashtable_t, put, void*, { old_value = pair->value; pair->value = value; + pair->key = key; break; } }