Skip to content

Commit 2c6fbc9

Browse files
authored
Merge pull request #39 from openwebf/fix/20230309
fix: add test specs and free atom when ic retain it
2 parents 9c14139 + 15af6c3 commit 2c6fbc9

File tree

2 files changed

+37
-3
lines changed

2 files changed

+37
-3
lines changed

src/core/function.c

+6-3
Original file line numberDiff line numberDiff line change
@@ -1489,7 +1489,8 @@ JSValue JS_CallInternal(JSContext* caller_ctx,
14891489
ic->updated = FALSE;
14901490
put_u8(pc - 5, OP_get_field_ic);
14911491
put_u32(pc - 4, ic->updated_offset);
1492-
JS_FreeAtom(ctx, atom);
1492+
// safe free call because ic struct will retain atom
1493+
JS_FreeAtom(ic->ctx, atom);
14931494
}
14941495
JS_FreeValue(ctx, sp[-1]);
14951496
sp[-1] = val;
@@ -1526,7 +1527,8 @@ JSValue JS_CallInternal(JSContext* caller_ctx,
15261527
ic->updated = FALSE;
15271528
put_u8(pc - 5, OP_get_field2_ic);
15281529
put_u32(pc - 4, ic->updated_offset);
1529-
JS_FreeAtom(ctx, atom);
1530+
// safe free call because ic struct will retain atom
1531+
JS_FreeAtom(ic->ctx, atom);
15301532
}
15311533
*sp++ = val;
15321534
}
@@ -1563,7 +1565,8 @@ JSValue JS_CallInternal(JSContext* caller_ctx,
15631565
ic->updated = FALSE;
15641566
put_u8(pc - 5, OP_put_field_ic);
15651567
put_u32(pc - 4, ic->updated_offset);
1566-
JS_FreeAtom(ctx, atom);
1568+
// safe free call because ic struct will retain atom
1569+
JS_FreeAtom(ic->ctx, atom);
15671570
}
15681571
}
15691572
BREAK;

tests/test_ic_atom_free.js

+31
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)