summaryrefslogtreecommitdiff
path: root/pp_pack.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2016-07-29 10:41:18 -0700
committerFather Chrysostomos <sprout@cpan.org>2016-07-29 12:39:37 -0700
commitb199a398054415071c9c89df8919653221399fb6 (patch)
tree3bf6b014bbad58fad69cc887e19613ab92075f90 /pp_pack.c
parentace3ad0f8709a7fde3c8e2a6249bb3f3fb7c7b16 (diff)
downloadperl-b199a398054415071c9c89df8919653221399fb6.tar.gz
Avoid emitting pack("p",...) warning erroneously
A value may legitimately be marked SvTEMP even when it is not about to be freed.
Diffstat (limited to 'pp_pack.c')
-rw-r--r--pp_pack.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/pp_pack.c b/pp_pack.c
index 891d2e2d42..40c310003c 100644
--- a/pp_pack.c
+++ b/pp_pack.c
@@ -3042,7 +3042,8 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist )
* of pack() (and all copies of the result) are
* gone.
*/
- if ((SvTEMP(fromstr) || (SvPADTMP(fromstr) &&
+ if (((SvTEMP(fromstr) && SvREFCNT(fromstr) == 1)
+ || (SvPADTMP(fromstr) &&
!SvREADONLY(fromstr)))) {
Perl_ck_warner(aTHX_ packWARN(WARN_PACK),
"Attempt to pack pointer to temporary value");