summaryrefslogtreecommitdiffhomepage
path: root/src/hash.c
diff options
context:
space:
mode:
authordearblue <[email protected]>2019-04-14 17:55:20 +0900
committerdearblue <[email protected]>2019-04-14 17:55:20 +0900
commitd328808892bf866f9ad72ba476fcee00edd06293 (patch)
tree78c35e3fa5ea8912c1ff8b6dd09c37f20eaae229 /src/hash.c
parent4d8ff2fba436708a349c858674088542a126cab1 (diff)
downloadmruby-d328808892bf866f9ad72ba476fcee00edd06293.tar.gz
mruby-d328808892bf866f9ad72ba476fcee00edd06293.zip
Fix memory leak for hash table index if occur out of memory
Diffstat (limited to 'src/hash.c')
-rw-r--r--src/hash.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/hash.c b/src/hash.c
index c4820513b..a9367a426 100644
--- a/src/hash.c
+++ b/src/hash.c
@@ -182,7 +182,7 @@ ht_index(mrb_state *mrb, htable *t)
if (!index || index->capa < size) {
index = (segindex*)mrb_realloc_simple(mrb, index, sizeof(segindex)+sizeof(struct segkv*)*size);
if (index == NULL) {
- mrb_free(mrb, index);
+ mrb_free(mrb, t->index);
t->index = NULL;
return;
}