This is a live mirror of the Perl 5 development currently hosted at
https://github.com/perl/perl5
https://perl5.git.perl.org
/
perl5.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
62f099e
)
regcomp.c: Really stop regexp-to-pv assignment from leaking
author
Father Chrysostomos
<sprout@cpan.org>
Mon, 29 Oct 2012 07:01:02 +0000
(
00:01
-0700)
committer
Father Chrysostomos
<sprout@cpan.org>
Tue, 30 Oct 2012 19:36:04 +0000
(12:36 -0700)
edd9fea2b8
was not enough. A scalar may hold a PV even with the
SvPOKp flag off:
$ ./perl -Ilib -e 'warn $$; while(1){ $x = "a"; $x = 1; $x = ${qr//}}'
regcomp.c
patch
|
blob
|
blame
|
history
diff --git
a/regcomp.c
b/regcomp.c
index
a0794b8
..
2007037
100644
(file)
--- a/
regcomp.c
+++ b/
regcomp.c
@@
-14179,7
+14179,7
@@
Perl_reg_temp_copy (pTHX_ REGEXP *ret_x, REGEXP *rx)
if (!ret_x)
ret_x = (REGEXP*) newSV_type(SVt_REGEXP);
else {
-
if (SvPOKp(ret_x))
SvPV_free(ret_x);
+ SvPV_free(ret_x);
SvOK_off((SV *)ret_x);
}
/* This ensures that SvTHINKFIRST(sv) is true, and hence that