libctf: fix hash removal
authorNick Alcock <nick.alcock@oracle.com>
Fri, 28 Jun 2019 20:58:31 +0000 (21:58 +0100)
committerNick Alcock <nick.alcock@oracle.com>
Mon, 1 Jul 2019 10:05:59 +0000 (11:05 +0100)
We must call htab_remove_elt with an element (in this case, a mocked-up
one with only the key populated, since no reasonable hash function will
need the other fields), not with the key alone.

libctf/
* ctf-hash.c (ctf_dynhash_remove): Call with a mocked-up element.

libctf/ChangeLog
libctf/ctf-hash.c

index d91abd278abe0f67bbafdc3ae63572980eed0949..dd3113b316cb53cc6ccc174f01a3170a4198ace8 100644 (file)
@@ -1,3 +1,7 @@
+2019-06-28  Nick Alcock <nick.alcock@oracle.com>
+
+       * ctf-hash.c (ctf_dynhash_remove): Call with a mocked-up element.
+
 2019-06-28  Nick Alcock <nick.alcock@oracle.com>
 
        * ctf-dump.c (ctf_dump_format_type): Prefix hex strings with 0x.
index adfe93e5c09a69c5d8cbf164f73e2d59598d1569..03a398e06c95e4d8a5ee75f9d105dba597ee6a47 100644 (file)
@@ -176,7 +176,8 @@ ctf_dynhash_insert (ctf_dynhash_t *hp, void *key, void *value)
 void
 ctf_dynhash_remove (ctf_dynhash_t *hp, const void *key)
 {
-  htab_remove_elt (hp->htab, (void *) key);
+  ctf_helem_t hep = { (void *) key, NULL, NULL, NULL };
+  htab_remove_elt (hp->htab, &hep);
 }
 
 void *
This page took 0.024217 seconds and 4 git commands to generate.