Commit 72efebc
committed
safer cleanup when failing to compile regexps
Prior to this commit when producing a warning the regexp compiler
would check if the warning category was marked as FATAL, and if it was
it would add clean up to the save stack to release buffers used during
compilation and to release the working REGEXP SV.
This causes two type of problems:
- if an error was already queued, Perl_ck_warner() returns even if
the warning is fatal, this meant that the normal clean up code
Perl_re_op_compile() would also run, resulting in a double free
of the buffers.
- without fatal warnings, if a $SIG{__WARN__} handler died, the
buffers and the working REGEXP SV would leak.
Avoid this by using SAVEDESTRUCTOR_X() to release the memory and
optionally the SV at the end of scope.
Fixes #216611 parent a28a6c1 commit 72efebc
2 files changed
+37
-30
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1213 | 1213 | | |
1214 | 1214 | | |
1215 | 1215 | | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
1216 | 1242 | | |
1217 | 1243 | | |
1218 | 1244 | | |
| |||
1294 | 1320 | | |
1295 | 1321 | | |
1296 | 1322 | | |
1297 | | - | |
1298 | | - | |
1299 | 1323 | | |
1300 | 1324 | | |
1301 | 1325 | | |
| |||
1307 | 1331 | | |
1308 | 1332 | | |
1309 | 1333 | | |
| 1334 | + | |
| 1335 | + | |
1310 | 1336 | | |
| 1337 | + | |
| 1338 | + | |
1311 | 1339 | | |
1312 | 1340 | | |
1313 | 1341 | | |
| |||
1708 | 1736 | | |
1709 | 1737 | | |
1710 | 1738 | | |
| 1739 | + | |
1711 | 1740 | | |
1712 | 1741 | | |
1713 | 1742 | | |
| |||
1783 | 1812 | | |
1784 | 1813 | | |
1785 | 1814 | | |
1786 | | - | |
| 1815 | + | |
1787 | 1816 | | |
1788 | 1817 | | |
1789 | 1818 | | |
1790 | 1819 | | |
1791 | | - | |
| 1820 | + | |
1792 | 1821 | | |
1793 | 1822 | | |
1794 | 1823 | | |
| |||
2307 | 2336 | | |
2308 | 2337 | | |
2309 | 2338 | | |
2310 | | - | |
2311 | | - | |
2312 | | - | |
2313 | | - | |
2314 | | - | |
2315 | | - | |
2316 | | - | |
2317 | | - | |
2318 | | - | |
2319 | | - | |
2320 | | - | |
2321 | | - | |
2322 | | - | |
2323 | | - | |
2324 | | - | |
2325 | | - | |
| 2339 | + | |
| 2340 | + | |
| 2341 | + | |
| 2342 | + | |
2326 | 2343 | | |
2327 | 2344 | | |
2328 | 2345 | | |
| |||
9212 | 9229 | | |
9213 | 9230 | | |
9214 | 9231 | | |
9215 | | - | |
9216 | 9232 | | |
9217 | 9233 | | |
9218 | 9234 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
886 | 886 | | |
887 | 887 | | |
888 | 888 | | |
889 | | - | |
890 | 889 | | |
891 | 890 | | |
892 | 891 | | |
| |||
919 | 918 | | |
920 | 919 | | |
921 | 920 | | |
922 | | - | |
923 | 921 | | |
924 | 922 | | |
925 | 923 | | |
| |||
935 | 933 | | |
936 | 934 | | |
937 | 935 | | |
938 | | - | |
939 | 936 | | |
940 | 937 | | |
941 | 938 | | |
| |||
952 | 949 | | |
953 | 950 | | |
954 | 951 | | |
955 | | - | |
956 | 952 | | |
957 | 953 | | |
958 | 954 | | |
| |||
965 | 961 | | |
966 | 962 | | |
967 | 963 | | |
968 | | - | |
969 | 964 | | |
970 | 965 | | |
971 | 966 | | |
972 | 967 | | |
973 | 968 | | |
974 | | - | |
975 | 969 | | |
976 | 970 | | |
977 | 971 | | |
978 | 972 | | |
979 | 973 | | |
980 | | - | |
981 | 974 | | |
982 | 975 | | |
983 | 976 | | |
| |||
1018 | 1011 | | |
1019 | 1012 | | |
1020 | 1013 | | |
1021 | | - | |
1022 | | - | |
1023 | 1014 | | |
1024 | 1015 | | |
1025 | 1016 | | |
| |||
0 commit comments