- Notifications
You must be signed in to change notification settings - Fork5.3k
Commite0a2337
committed
Fix two low-probability memory leaks in regular expression parsing.
If pg_regcomp failed after having invoked markst/cleanst, it would leak any"struct subre" nodes it had created. (We've already detected all regexsyntax errors at that point, so the only likely causes of later failurewould be query cancel or out-of-memory.) To fix, make sure freesrnodeknows the difference between the pre-cleanst and post-cleanst cleanupprocedures. Add some documentation of this less-than-obvious point.Also, newlacon did the wrong thing with an out-of-memory failure fromrealloc(), so that the previously allocated array would be leaked.Both of these are pretty low-probability scenarios, but a bug is a bug,so patch all the way back.Per bug #10976 from Arthur O'Dwyer.1 parent4b76778 commite0a2337
1 file changed
+24
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1646 | 1646 | | |
1647 | 1647 | | |
1648 | 1648 | | |
1649 | | - | |
| 1649 | + | |
1650 | 1650 | | |
| 1651 | + | |
1651 | 1652 | | |
1652 | 1653 | | |
1653 | 1654 | | |
| |||
1693 | 1694 | | |
1694 | 1695 | | |
1695 | 1696 | | |
| 1697 | + | |
| 1698 | + | |
| 1699 | + | |
| 1700 | + | |
| 1701 | + | |
| 1702 | + | |
| 1703 | + | |
| 1704 | + | |
| 1705 | + | |
| 1706 | + | |
| 1707 | + | |
| 1708 | + | |
| 1709 | + | |
| 1710 | + | |
1696 | 1711 | | |
1697 | 1712 | | |
1698 | 1713 | | |
| |||
1790 | 1805 | | |
1791 | 1806 | | |
1792 | 1807 | | |
| 1808 | + | |
1793 | 1809 | | |
1794 | 1810 | | |
1795 | 1811 | | |
1796 | 1812 | | |
1797 | | - | |
1798 | 1813 | | |
1799 | | - | |
| 1814 | + | |
1800 | 1815 | | |
1801 | 1816 | | |
1802 | 1817 | | |
1803 | | - | |
1804 | | - | |
1805 | | - | |
| 1818 | + | |
| 1819 | + | |
| 1820 | + | |
1806 | 1821 | | |
1807 | | - | |
| 1822 | + | |
1808 | 1823 | | |
1809 | 1824 | | |
1810 | 1825 | | |
1811 | 1826 | | |
| 1827 | + | |
| 1828 | + | |
1812 | 1829 | | |
1813 | 1830 | | |
1814 | 1831 | | |
| |||
0 commit comments
Comments
(0)