Skip to content
This repository has been archived by the owner on Feb 3, 2021. It is now read-only.

Commit

Permalink
Forgot to allocate some memory zeroed, which caused all manner of fun.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Oct 2, 2010
1 parent 5ece5ae commit c3553ca
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/metamodel/reprs/P6opaque.c
Expand Up @@ -156,7 +156,7 @@ static PMC * instance_of(PARROT_INTERP, PMC *self, PMC *WHAT) {
/* Allocate and set up object instance. */
obj = mem_allocate_zeroed_typed(P6opaqueInstance);
obj->common.stable = STABLE_PMC(WHAT);
obj->slots = mem_sys_allocate(sizeof(PMC *) *
obj->slots = mem_sys_allocate_zeroed(sizeof(PMC *) *
repr->num_slots == 0 ? 1 : repr->num_slots);

return wrap_object(interp, obj);
Expand All @@ -181,8 +181,9 @@ static PMC * get_attribute(PARROT_INTERP, PMC *self, PMC *obj, PMC *class_handle
if (!PMC_IS_NULL(class_mapping)) {
if (VTABLE_exists_keyed_str(interp, class_mapping, name))
{
INTVAL position = VTABLE_get_integer_keyed_str(interp, class_mapping, name);
return instance->slots[position];
INTVAL position = VTABLE_get_integer_keyed_str(interp, class_mapping, name);
PMC *result = instance->slots[position];
return result ? result : PMCNULL;
}
}
}
Expand Down

0 comments on commit c3553ca

Please sign in to comment.