Skip to content

Commit 02eab5f

Browse files
committed
class.c: Correct allocation of OP_ARGCHECK aux structure
The original code was wrong on two counts: * Using Newx() instead of PerlMemShared_malloc() * Creating a generic UNOP_AUX_item array instead of the special struct type
1 parent 85a3d70 commit 02eab5f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

class.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -992,14 +992,14 @@ apply_field_attribute_reader(pTHX_ PADNAME *pn, SV *value)
992992

993993
OP *argcheckop;
994994
{
995-
UNOP_AUX_item *aux;
996-
Newx(aux, 3, UNOP_AUX_item);
995+
struct op_argcheck_aux *aux = (struct op_argcheck_aux *)
996+
PerlMemShared_malloc(sizeof(*aux));
997997

998-
aux[0].iv = 0; /* params */
999-
aux[1].iv = 0; /* opt_params */
1000-
aux[2].iv = 0; /* slurpy */
998+
aux->params = 0;
999+
aux->opt_params = 0;
1000+
aux->slurpy = 0;
10011001

1002-
argcheckop = newUNOP_AUX(OP_ARGCHECK, 0, NULL, aux);
1002+
argcheckop = newUNOP_AUX(OP_ARGCHECK, 0, NULL, (UNOP_AUX_item *)aux);
10031003
}
10041004

10051005
OP *retop;

0 commit comments

Comments
 (0)