Skip to content

Commit 56d057a

Browse files
committed
Another write barrier; fix a leak.
1 parent 7f5c477 commit 56d057a

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/ops/nqp.ops

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,8 +783,10 @@ Sets an object's serialization context.
783783

784784
*/
785785
inline op nqp_set_sc_for_object(in PMC, in PMC) :base_core {
786-
if ($1->vtable->base_type == smo_id)
786+
if ($1->vtable->base_type == smo_id) {
787787
SC_PMC($1) = $2;
788+
PARROT_GC_WRITE_BARRIER(interp, $1);
789+
}
788790
else
789791
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
790792
"Can only use nqp_set_sc_for_object with a SixModelObject");

src/pmc/stable.pmc

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,16 @@ pmclass STable manual_attrs dynpmc group nqp {
6868
VTABLE void destroy() {
6969
/* If a v-table was allocated, free that. */
7070
STable *st = (STable *)PMC_data(SELF);
71-
if (st->vtable)
71+
if (st->vtable) {
7272
mem_sys_free(st->vtable);
73+
st->vtable = NULL;
74+
}
75+
76+
/* If a Parrot v-table mapping was installed, free that. */
77+
if (st->parrot_vtable_mapping) {
78+
mem_sys_free(st->parrot_vtable_mapping);
79+
st->parrot_vtable_mapping = NULL;
80+
}
7381

7482
/* Free the underlying struct. */
7583
mem_sys_free(PMC_data(SELF));

0 commit comments

Comments
 (0)