From: Vincent Pit Date: Mon, 28 Dec 2009 18:12:46 +0000 (+0100) Subject: Fix memory miswrite when passing data arguments to cast() X-Git-Tag: v0.40~13 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FVariable-Magic.git;a=commitdiff_plain;h=92c40234ffc0926116f49aefc39ce87103105bd2 Fix memory miswrite when passing data arguments to cast() --- diff --git a/Magic.xs b/Magic.xs index 183bfbd..537f1e2 100644 --- a/Magic.xs +++ b/Magic.xs @@ -1414,15 +1414,12 @@ PROTOTYPE: \[$@%&*]$@ PREINIT: SV **args = NULL; I32 i = 0; - SV *ret; CODE: if (items > 2) { i = items - 2; args = &ST(2); } - ret = newSVuv(vmg_cast(SvRV(sv), vmg_wizard_validate(wiz), args, i)); - SvREFCNT_dec(args); - RETVAL = ret; + RETVAL = newSVuv(vmg_cast(SvRV(sv), vmg_wizard_validate(wiz), args, i)); OUTPUT: RETVAL