From 3e10cffc9872fda4519f76ba487fd108551a179f Mon Sep 17 00:00:00 2001 From: Nick Alcock Date: Fri, 28 Jun 2019 21:58:31 +0100 Subject: [PATCH] libctf: fix hash removal 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 | 4 ++++ libctf/ctf-hash.c | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libctf/ChangeLog b/libctf/ChangeLog index d91abd278ab..dd3113b316c 100644 --- a/libctf/ChangeLog +++ b/libctf/ChangeLog @@ -1,3 +1,7 @@ +2019-06-28 Nick Alcock + + * ctf-hash.c (ctf_dynhash_remove): Call with a mocked-up element. + 2019-06-28 Nick Alcock * ctf-dump.c (ctf_dump_format_type): Prefix hex strings with 0x. diff --git a/libctf/ctf-hash.c b/libctf/ctf-hash.c index adfe93e5c09..03a398e06c9 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.30.2