Skip to content

Commit 09d4d88

Browse files
committed
parser.c: handle eagerly freed rstack in rvalue_stack_mark
1 parent 101f734 commit 09d4d88

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ext/json/ext/parser/parser.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,10 @@ static void rvalue_stack_mark(void *ptr)
241241
{
242242
rvalue_stack *stack = (rvalue_stack *)ptr;
243243
long index;
244-
for (index = 0; index < stack->head; index++) {
245-
rb_gc_mark(stack->ptr[index]);
244+
if (stack && stack->ptr) {
245+
for (index = 0; index < stack->head; index++) {
246+
rb_gc_mark(stack->ptr[index]);
247+
}
246248
}
247249
}
248250

0 commit comments

Comments
 (0)