(assoc_rehash): Fix an incorrect element size calculation.
Showing
1 changed file
with
2 additions
and
2 deletions
... | @@ -97,7 +97,7 @@ assoc_rehash (mu_assoc_t assoc) | ... | @@ -97,7 +97,7 @@ assoc_rehash (mu_assoc_t assoc) |
97 | if (hash_num >= max_rehash) | 97 | if (hash_num >= max_rehash) |
98 | return MU_ERR_BUFSPACE; | 98 | return MU_ERR_BUFSPACE; |
99 | 99 | ||
100 | new_tab = calloc (hash_size[hash_num], assoc->elsize); | 100 | new_tab = calloc (hash_size[hash_num], ASSOC_ELEM_SIZE (assoc)); |
101 | assoc->tab = new_tab; | 101 | assoc->tab = new_tab; |
102 | if (old_tab) | 102 | if (old_tab) |
103 | { | 103 | { |
... | @@ -114,7 +114,7 @@ assoc_rehash (mu_assoc_t assoc) | ... | @@ -114,7 +114,7 @@ assoc_rehash (mu_assoc_t assoc) |
114 | if (rc) | 114 | if (rc) |
115 | return rc; | 115 | return rc; |
116 | newp->name = elt->name; | 116 | newp->name = elt->name; |
117 | memcpy(newp->data, elt->data, assoc->elsize);; | 117 | memcpy(newp->data, elt->data, assoc->elsize); |
118 | } | 118 | } |
119 | } | 119 | } |
120 | free (old_tab); | 120 | free (old_tab); | ... | ... |
-
Please register or sign in to post a comment