diff options
author | Nick Alcock <nick.alcock@oracle.com> | 2019-07-24 15:21:56 +0100 |
---|---|---|
committer | Nick Alcock <nick.alcock@oracle.com> | 2019-10-03 17:04:55 +0100 |
commit | 1820745a0af0768d9dcd515b98ad038ff9f15f23 (patch) | |
tree | 8904098f8a9792eefe985e0f194c2ac7a76333cb /libctf/ChangeLog | |
parent | 5de9eada3b4e39c89431765b1c59159cb04878ed (diff) | |
download | fsf-binutils-gdb-1820745a0af0768d9dcd515b98ad038ff9f15f23.zip fsf-binutils-gdb-1820745a0af0768d9dcd515b98ad038ff9f15f23.tar.gz fsf-binutils-gdb-1820745a0af0768d9dcd515b98ad038ff9f15f23.tar.bz2 |
libctf: don't leak hash keys or values on value replacement
When a ctf_dynhash_insert() finds a slot already existing, it should
call the key and value free functions on the existing key and value and
move the passed-in key into place, so that the lifetime rules for hash
keys are always the same no matter whether the key existed or not but
neither are the keys or values leaked.
New in v3.
v5: fix tabdamage.
libctf/
* ctf-hash.c (ctf_hashtab_insert): Pass in the key and value
freeing functions: if set, free the key and value if the slot
already exists. Always reassign the key.
(ctf_dynhash_insert): Adjust call appropriately.
(ctf_hash_insert_type): Likewise.
Diffstat (limited to 'libctf/ChangeLog')
-rw-r--r-- | libctf/ChangeLog | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libctf/ChangeLog b/libctf/ChangeLog index 28be757..08a2e3a 100644 --- a/libctf/ChangeLog +++ b/libctf/ChangeLog @@ -1,3 +1,11 @@ +2019-07-30 Nick Alcock <nick.alcock@oracle.com> + + * ctf-hash.c (ctf_hashtab_insert): Pass in the key and value + freeing functions: if set, free the key and value if the slot + already exists. Always reassign the key. + (ctf_dynhash_insert): Adjust call appropriately. + (ctf_hash_insert_type): Likewise. + 2019-08-03 Nick Alcock <nick.alcock@oracle.com> * ctf-create.c (ctf_add_type): Look up and use the forwarded-to |