This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH 2/5] libctf: fix hash removal
- From: Nick Alcock <nick dot alcock at oracle dot com>
- To: binutils at sourceware dot org
- Cc: jose dot marchesi at oracle dot com, indu dot bhagat at oracle dot com, elena dot zannoni at oracle dot com
- Date: Sun, 30 Jun 2019 19:13:56 +0100
- Subject: [PATCH 2/5] libctf: fix hash removal
- References: <20190630181359.98029-1-nick.alcock@oracle.com>
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/ctf-hash.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libctf/ctf-hash.c b/libctf/ctf-hash.c
index adfe93e5c0..03a398e06c 100644
--- a/libctf/ctf-hash.c
+++ b/libctf/ctf-hash.c
@@ -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 *
--
2.22.0.238.g049a27acdc