summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorRichard Leach <richardleach@users.noreply.github.com>2022-09-09 21:44:29 +0000
committerRichard Leach <richardleach@users.noreply.github.com>2022-09-18 23:50:26 +0100
commit51918aaf0287a9f5643ea3161fd8c6091a127428 (patch)
tree91e7f021d635b70a9cfd78f8083050b0580deb73 /regcomp.c
parent8af03a11d8197fbbc9700846c4aa5c1baa32b281 (diff)
downloadperl-51918aaf0287a9f5643ea3161fd8c6091a127428.tar.gz
S_regclass - use SvPVCLEAR_FRESH on new SV
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/regcomp.c b/regcomp.c
index fa8cb4d514..ccea5fd67c 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -18444,8 +18444,8 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth,
* points. */
AV * this_string = (AV *) av_shift( strings);
STRLEN cp_count = av_count(this_string);
- SV * final = newSV(cp_count * 4);
- SvPVCLEAR(final);
+ SV * final = newSV(cp_count ? cp_count * 4 : 1);
+ SvPVCLEAR_FRESH(final);
/* Create another string of sequences of \x{...} */
while (av_count(this_string) > 0) {