Fix memory leak for hash table index if occur out of memory

This commit is contained in:
dearblue
2019-04-14 17:55:20 +09:00
parent 4d8ff2fba4
commit d328808892
+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;
}