diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-04-15 09:56:03 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-04-15 09:56:03 +0300 |
commit | 84db10f27bdb4c8d9edf7f554afdcd2a24e3285a (patch) | |
tree | 5f9d5b22cdfee6f147274d85b279d98f8a1bb46b /mysys/hash.c | |
parent | 9aacda409db8606b985a93f675487943846cbc86 (diff) | |
parent | ccaec18b3934ee384296b4597bdf462fac66c5a4 (diff) | |
download | mariadb-git-84db10f27bdb4c8d9edf7f554afdcd2a24e3285a.tar.gz |
Merge 10.2 into 10.3
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 bf2c176f9df..077895ed677 100644 --- a/mysys/hash.c +++ b/mysys/hash.c @@ -116,17 +116,23 @@ my_hash_init2(HASH *hash, uint growth_size, CHARSET_INFO *charset, 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); } } |