summaryrefslogtreecommitdiff
path: root/perl.c
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2022-09-26 15:03:50 +1000
committerTony Cook <tony@develop-help.com>2022-11-02 09:35:07 +1100
commita1aa0ce969357a471f335bc9f9362f49f178b1fe (patch)
treea7a5b2e33e8d7480ce3b47a90e0e4548a93f8a6b /perl.c
parent8720ab89901b4674570b078a259b3749153f0283 (diff)
downloadperl-a1aa0ce969357a471f335bc9f9362f49f178b1fe.tar.gz
We freed PL_splitstr in each thread, allocate it in each thread too
I also fixed const correctness for PL_splitstr, it was initialized to " " which required it to be const, but the value is only looked at when PL_minus_F is true, so it wasn't necessary. So initialize it to NULL, and duplicate the value in threads.
Diffstat (limited to 'perl.c')
-rw-r--r--perl.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/perl.c b/perl.c
index 67906d7019..4e4bf2a81b 100644
--- a/perl.c
+++ b/perl.c
@@ -3585,9 +3585,11 @@ Perl_moreswitches(pTHX_ const char *s)
PL_minus_a = TRUE;
PL_minus_F = TRUE;
PL_minus_n = TRUE;
- PL_splitstr = ++s;
- while (*s && !isSPACE(*s)) ++s;
- PL_splitstr = savepvn(PL_splitstr, s - PL_splitstr);
+ {
+ const char *start = ++s;
+ while (*s && !isSPACE(*s)) ++s;
+ PL_splitstr = savepvn(start, s - start);
+ }
return s;
case 'a':
PL_minus_a = TRUE;