summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
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) {