summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2019-04-14 20:36:29 +0900
committerGitHub <[email protected]>2019-04-14 20:36:29 +0900
commitea6aab20e8c81869a3e673bccb985dc1aaa5cfcc (patch)
tree1f8d144156c852870044d17107e0fd7e51ad3bc2
parent6ad89d30d22021e15e9a0ed8e26f5db53fada4d5 (diff)
parentd328808892bf866f9ad72ba476fcee00edd06293 (diff)
downloadmruby-ea6aab20e8c81869a3e673bccb985dc1aaa5cfcc.tar.gz
mruby-ea6aab20e8c81869a3e673bccb985dc1aaa5cfcc.zip
Merge pull request #4378 from dearblue/memleak-hashtable
Fix memory leak for hash table index if occur out of memory
-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;
}