summaryrefslogtreecommitdiff
path: root/mjit_worker.c
diff options
context:
space:
mode:
authork0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-20 11:21:07 (GMT)
committerk0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-20 11:21:07 (GMT)
commit67e2373f06d77ee73e8ec9b5cb826c2478576063 (patch)
tree894bdd076430d19f5b4592121a5cc6238342c644 /mjit_worker.c
parent4ae20f046e29649abf1515c02acf2d8f8aef2e06 (diff)
mjit_worker.c: don't refer to freed value
remove_from_list() frees node, but after that node->next could be used git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65231 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'mjit_worker.c')
-rw-r--r--mjit_worker.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/mjit_worker.c b/mjit_worker.c
index 1865d30..dbf21cc 100644
--- a/mjit_worker.c
+++ b/mjit_worker.c
@@ -499,13 +499,14 @@ mjit_valid_class_serial_p(rb_serial_t class_serial)
static struct rb_mjit_unit_node *
get_from_list(struct rb_mjit_unit_list *list)
{
- struct rb_mjit_unit_node *node, *best = NULL;
+ struct rb_mjit_unit_node *node, *next, *best = NULL;
if (list->head == NULL)
return NULL;
/* Find iseq with max total_calls */
- for (node = list->head; node != NULL; node = node ? node->next : NULL) {
+ for (node = list->head; node != NULL; node = next) {
+ next = node->next;
if (node->unit->iseq == NULL) { /* ISeq is GCed. */
free_unit(node->unit);
remove_from_list(node, list);