diff options
author | Karl Williamson <khw@cpan.org> | 2014-11-17 21:49:08 -0700 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2014-11-18 10:13:20 -0700 |
commit | 512e01ab009bc6309309e05891effe8ae3c0e9da (patch) | |
tree | 92ecf9adff2639cd74e1b50909cc11e64f267a64 /regcomp.c | |
parent | 4692fc6a8864d5b51d14d412f2c36e08fbad8626 (diff) | |
download | perl-512e01ab009bc6309309e05891effe8ae3c0e9da.tar.gz |
PATCH: [perl #123198] Memory leak in regex in 5.20.1
The SV was declared temporary but the pointer to it was getting changed
to another SV under some circumstances and the reference to that wasn't
getting decremented. The temporary stemmed from earlier code and was no
longer needed. Now, an explicit reference decrement is always done.
Diffstat (limited to 'regcomp.c')
-rw-r--r-- | regcomp.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -5144,7 +5144,7 @@ PerlIO_printf(Perl_debug_log, "LHS=%"UVuf" RHS=%"UVuf"\n", min++; if (flags & SCF_DO_STCLASS) { bool invert = 0; - SV* my_invlist = sv_2mortal(_new_invlist(0)); + SV* my_invlist = NULL; U8 namedclass; /* See commit msg 749e076fceedeb708a624933726e7989f2302f6a */ @@ -5243,7 +5243,7 @@ PerlIO_printf(Perl_debug_log, "LHS=%"UVuf" RHS=%"UVuf"\n", /* FALLTHROUGH */ case POSIXA: if (FLAGS(scan) == _CC_ASCII) { - my_invlist = PL_XPosix_ptrs[_CC_ASCII]; + my_invlist = invlist_clone(PL_XPosix_ptrs[_CC_ASCII]); } else { _invlist_intersection(PL_XPosix_ptrs[FLAGS(scan)], @@ -5280,6 +5280,7 @@ PerlIO_printf(Perl_debug_log, "LHS=%"UVuf" RHS=%"UVuf"\n", assert(flags & SCF_DO_STCLASS_OR); ssc_union(data->start_class, my_invlist, invert); } + SvREFCNT_dec(my_invlist); } if (flags & SCF_DO_STCLASS_OR) ssc_and(pRExC_state, data->start_class, (regnode_charclass *) and_withp); |