This sub initially creates a new OP_COREARGS op to be made use of in the
various cases of a following switch statement. But in the specific case
of OP_SELECT, the op isn't actually used, and leaks. So don't allocate
it in this case.
The leak could be reproduced with the one-liner
defined &{"CORE::select"};
and was causing t/op/coresubs.t to fail under Address Sanitiser.
Perl_coresub_op(pTHX_ SV * const coreargssv, const int code,
const int opnum)
{
- OP * const argop = newSVOP(OP_COREARGS,0,coreargssv);
+ OP * const argop = (opnum == OP_SELECT && code) ? NULL :
+ newSVOP(OP_COREARGS,0,coreargssv);
OP *o;
PERL_ARGS_ASSERT_CORESUB_OP;