diff options
author | Elijah Newren <newren@gmail.com> | 2020-11-02 18:55:03 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-11-02 12:15:50 -0800 |
commit | b7879b0ba6ee1306a42227f7fd7f4e5f50409184 (patch) | |
tree | 32f328d974b2a59154e062edacda2158935d1fd7 /t/t4013/diff.noellipses-diff-tree_--root_-r_--abbrev=4_initial | |
parent | hashmap: adjust spacing to fix argument alignment (diff) | |
download | tgif-b7879b0ba6ee1306a42227f7fd7f4e5f50409184.tar.xz |
hashmap: allow re-use after hashmap_free()
Previously, once map->table had been freed, any calls to hashmap_put(),
hashmap_get(), or hashmap_remove() would cause a NULL pointer
dereference (since hashmap_free_() also zeros the memory; without that
zeroing, calling these functions would cause a use-after-free problem).
Modify these functions to check for a NULL table and automatically
allocate as needed.
Also add a HASHMAP_INIT(fn, data) macro for initializing hashmaps on the
stack without calling hashmap_init().
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4013/diff.noellipses-diff-tree_--root_-r_--abbrev=4_initial')
0 files changed, 0 insertions, 0 deletions