From 02eab5f70481e9f3f31398117316422c7400507a Mon Sep 17 00:00:00 2001 From: "Paul \"LeoNerd\" Evans" Date: Thu, 8 Feb 2024 21:55:09 +0000 Subject: [PATCH] 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 --- class.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/class.c b/class.c index b30d5962bed7..64003f26d8ac 100644 --- a/class.c +++ b/class.c @@ -992,14 +992,14 @@ apply_field_attribute_reader(pTHX_ PADNAME *pn, SV *value) OP *argcheckop; { - UNOP_AUX_item *aux; - Newx(aux, 3, UNOP_AUX_item); + struct op_argcheck_aux *aux = (struct op_argcheck_aux *) + PerlMemShared_malloc(sizeof(*aux)); - aux[0].iv = 0; /* params */ - aux[1].iv = 0; /* opt_params */ - aux[2].iv = 0; /* slurpy */ + aux->params = 0; + aux->opt_params = 0; + aux->slurpy = 0; - argcheckop = newUNOP_AUX(OP_ARGCHECK, 0, NULL, aux); + argcheckop = newUNOP_AUX(OP_ARGCHECK, 0, NULL, (UNOP_AUX_item *)aux); } OP *retop;