summaryrefslogtreecommitdiff
path: root/mjit_worker.c
diff options
context:
space:
mode:
authork0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-11 14:34:05 (GMT)
committerk0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-11 14:34:05 (GMT)
commit5cd84d247f4fc7c4aeb28d2b7a846f03337e6db7 (patch)
tree0f9abed0a38de3a8ffe8ef6084b12934cab1004a /mjit_worker.c
parent3c1f1c33488f79a1c4cb95eb67d3f1832ab51078 (diff)
mjit_worker.c: handle calloc failure
Unlike ZALLOC, it's not automatically handled. mjit.c: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'mjit_worker.c')
-rw-r--r--mjit_worker.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/mjit_worker.c b/mjit_worker.c
index c37bec8..adc96ab 100644
--- a/mjit_worker.c
+++ b/mjit_worker.c
@@ -319,6 +319,7 @@ static struct rb_mjit_unit_node *
create_list_node(struct rb_mjit_unit *unit)
{
struct rb_mjit_unit_node *node = (struct rb_mjit_unit_node *)calloc(1, sizeof(struct rb_mjit_unit_node)); /* To prevent GC, don't use ZALLOC */
+ if (node == NULL) return NULL;
node->unit = unit;
return node;
}
@@ -1116,6 +1117,11 @@ convert_unit_to_func(struct rb_mjit_unit *unit)
if ((uintptr_t)func > (uintptr_t)LAST_JIT_ISEQ_FUNC) {
struct rb_mjit_unit_node *node = create_list_node(unit);
+ if (node == NULL) {
+ mjit_warning("failed to allocate a node to be added to active_units");
+ return (mjit_func_t)NOT_COMPILED_JIT_ISEQ_FUNC;
+ }
+
CRITICAL_SECTION_START(3, "end of jit");
add_to_list(node, &active_units);
if (unit->iseq)