diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-04-25 21:57:52 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-04-25 21:57:52 +0300 |
commit | fbe2712705d464bf8488df249c36115e2c1f63f7 (patch) | |
tree | 274e728c719611769288afcb10f79549f6e11f8c /mysys/hash.c | |
parent | 62903434eb009cb0bcd5003b0a45914bd4c09886 (diff) | |
parent | a19782522b1eac52d72f5e787b5d96f1fd1a2cb7 (diff) | |
download | mariadb-git-fbe2712705d464bf8488df249c36115e2c1f63f7.tar.gz |
Merge 10.4 into 10.5
The functional changes of commit 5836191c8f0658d5d75484766fdcc3d838b0a5c1
(MDEV-21168) are omitted due to MDEV-742 having addressed the issue.
Diffstat (limited to 'mysys/hash.c')
-rw-r--r-- | mysys/hash.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/mysys/hash.c b/mysys/hash.c index 347e0cfda8a..87d714d6148 100644 --- a/mysys/hash.c +++ b/mysys/hash.c @@ -116,17 +116,23 @@ my_hash_init2(PSI_memory_key psi_key, HASH *hash, uint growth_size, static inline void my_hash_free_elements(HASH *hash) { uint records= hash->records; + if (records == 0) + return; + /* Set records to 0 early to guard against anyone looking at the structure during the free process */ hash->records= 0; + if (hash->free) { HASH_LINK *data=dynamic_element(&hash->array,0,HASH_LINK*); HASH_LINK *end= data + records; - while (data < end) + do + { (*hash->free)((data++)->data); + } while (data < end); } } |