Merge pull request #4378 from dearblue/memleak-hashtable

Fix memory leak for hash table index if occur out of memory
This commit is contained in:
Yukihiro "Matz" Matsumoto
2019-04-14 20:36:29 +09:00
committed by GitHub
+1 -1
View File
@@ -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;
}