Skip to content

Commit

Permalink
Fixed: Attempt to free unreferenced scalar:
Browse files Browse the repository at this point in the history
  • Loading branch information
kfly8 committed Aug 13, 2024
1 parent a7ad96d commit b8dcac4
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lib/Syntax/Keyword/Assert.xs
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,31 @@ static bool is_strict(pTHX_)
return ok;
}

static OP *make_mycroak(pTHX_ OP *msg)
static OP *make_xcroak(pTHX_ OP *msg)
{
GV *mycroak_gv = gv_fetchpv("Syntax::Keyword::Assert::_croak", GV_ADD, SVt_PVCV);
OP *mycroak = newUNOP(OP_NULL, 0, newSVOP(OP_GV, 0, (SV *)mycroak_gv));

return newUNOP(OP_ENTERSUB, OPf_STACKED, op_append_elem(OP_LIST, msg, mycroak));
OP *xcroak;
xcroak = newCVREF(
OPf_WANT_SCALAR,
newSVOP(OP_CONST, 0, newSVpvs("Syntax::Keyword::Assert::_croak"))
);
xcroak = newUNOP(OP_ENTERSUB, OPf_STACKED, op_append_elem(OP_LIST, msg, xcroak));
return xcroak;
}

static int build_assert(pTHX_ OP **out, XSParseKeywordPiece *arg0, void *hookdata)
{
OP *block = arg0->op;

if (is_strict()) {
// build the following code:
//
// Syntax::Keyword::Assert::_croak "Assertion failed"
// unless do { $a == 1 }
//
OP *block = arg0->op;
OP *msg = newSVOP(OP_CONST, 0, newSVpvs("Assertion failed"));

// FIXME Attempt to free unreferenced scalar: SV 0x14f7c18c8.

*out = newLOGOP(OP_AND, 0,
newUNOP(OP_NOT, 0, block),
make_mycroak(aTHX_ msg)
make_xcroak(aTHX_ msg)
);
}
else {
Expand Down

0 comments on commit b8dcac4

Please sign in to comment.