File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -1665,6 +1665,7 @@ dup_environ(pTHX)
1665
1665
1666
1666
size_t n_entries = 0 , vars_size = 0 ;
1667
1667
1668
+ ENV_READ_LOCK ;
1668
1669
for (char * * ep = environ ; * ep ; ++ ep ) {
1669
1670
++ n_entries ;
1670
1671
vars_size += strlen (* ep ) + 1 ;
@@ -1682,9 +1683,14 @@ dup_environ(pTHX)
1682
1683
new_environ [i ] = (char * ) CopyD (environ [i ], vars + copied , len , char );
1683
1684
copied += len ;
1684
1685
}
1686
+
1687
+ ENV_READ_UNLOCK ;
1688
+
1685
1689
new_environ [n_entries ] = NULL ;
1686
1690
1691
+ ENV_LOCK ;
1687
1692
environ = new_environ ;
1693
+ ENV_UNLOCK ;
1688
1694
/* Store a pointer in a global variable to ensure it's always reachable so
1689
1695
* LeakSanitizer/Valgrind won't complain about it. We can't ever free it.
1690
1696
* Even if libc allocates a new environ, it's possible that some of its
You can’t perform that action at this time.
0 commit comments