Replace hashtable key if a put operation replaces value
authorMartin Willi <martin@revosec.ch>
Thu, 3 Feb 2011 15:58:12 +0000 (16:58 +0100)
committerMartin Willi <martin@revosec.ch>
Thu, 3 Feb 2011 16:09:09 +0000 (17:09 +0100)
Fixes a crash if lifetime of key is bound to value (i.e. key == value)

src/libstrongswan/utils/hashtable.c

index 3b7148e..49b0bb6 100644 (file)
@@ -249,6 +249,7 @@ METHOD(hashtable_t, put, void*,
                        {
                                old_value = pair->value;
                                pair->value = value;
+                               pair->key = key;
                                break;
                        }
                }