forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit1c99cde
committed
Improve JsonLexContext's freeability
Previously, the JSON code didn't have to worry too much about freeingJsonLexContext, because it was never too long-lived. With new featuresbeing added for SQL/JSON this is no longer the case. Add a routinethat knows how to free this struct and apply that to a few places, toprevent this from becoming problematic.At the same time, we change the API of makeJsonLexContextCstringLen tomake it receive a pointer to JsonLexContext for callers that want it tobe stack-allocated; it can also be passed as NULL to get the originalbehavior of a palloc'ed one.This also causes an ABI break due to the addition of flags toJsonLexContext, so we can't easily backpatch it. AFAICS that's not muchof a problem; apparently some leaks might exist in JSON usage oftext-search, for example via json_to_tsvector, but I haven't seen anycomplaints about that.Per Coverity complaint about datum_to_jsonb_internal().Discussion:https://postgr.es/m/20230808174110.oq3iymllsv6amkih@alvherre.pgsql1 parenta8a968a commit1c99cde
File tree
7 files changed
+153
-86
lines changed- src
- backend/utils/adt
- bin/pg_verifybackup
- common
- include
- common
- utils
7 files changed
+153
-86
lines changedLines changed: 22 additions & 17 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
106 | 106 |
| |
107 | 107 |
| |
108 | 108 |
| |
109 |
| - | |
| 109 | + | |
110 | 110 |
| |
111 | 111 |
| |
112 |
| - | |
113 |
| - | |
| 112 | + | |
| 113 | + | |
114 | 114 |
| |
115 | 115 |
| |
116 | 116 |
| |
| |||
152 | 152 |
| |
153 | 153 |
| |
154 | 154 |
| |
155 |
| - | |
| 155 | + | |
156 | 156 |
| |
157 | 157 |
| |
158 | 158 |
| |
159 | 159 |
| |
160 |
| - | |
161 |
| - | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
162 | 163 |
| |
163 | 164 |
| |
164 | 165 |
| |
| |||
1625 | 1626 |
| |
1626 | 1627 |
| |
1627 | 1628 |
| |
1628 |
| - | |
| 1629 | + | |
1629 | 1630 |
| |
1630 | 1631 |
| |
1631 | 1632 |
| |
1632 | 1633 |
| |
| 1634 | + | |
| 1635 | + | |
1633 | 1636 |
| |
1634 | 1637 |
| |
1635 |
| - | |
| 1638 | + | |
1636 | 1639 |
| |
1637 | 1640 |
| |
1638 | 1641 |
| |
| |||
1644 | 1647 |
| |
1645 | 1648 |
| |
1646 | 1649 |
| |
1647 |
| - | |
| 1650 | + | |
1648 | 1651 |
| |
1649 | 1652 |
| |
1650 | 1653 |
| |
1651 | 1654 |
| |
1652 |
| - | |
| 1655 | + | |
1653 | 1656 |
| |
1654 | 1657 |
| |
1655 | 1658 |
| |
| |||
1664 | 1667 |
| |
1665 | 1668 |
| |
1666 | 1669 |
| |
| 1670 | + | |
| 1671 | + | |
| 1672 | + | |
1667 | 1673 |
| |
1668 | 1674 |
| |
1669 | 1675 |
| |
| |||
1683 | 1689 |
| |
1684 | 1690 |
| |
1685 | 1691 |
| |
1686 |
| - | |
| 1692 | + | |
1687 | 1693 |
| |
1688 |
| - | |
1689 | 1694 |
| |
1690 | 1695 |
| |
1691 | 1696 |
| |
1692 |
| - | |
| 1697 | + | |
| 1698 | + | |
1693 | 1699 |
| |
1694 |
| - | |
1695 |
| - | |
| 1700 | + | |
1696 | 1701 |
| |
1697 |
| - | |
| 1702 | + | |
1698 | 1703 |
| |
1699 | 1704 |
| |
1700 | 1705 |
| |
| |||
1716 | 1721 |
| |
1717 | 1722 |
| |
1718 | 1723 |
| |
1719 |
| - | |
| 1724 | + | |
1720 | 1725 |
| |
1721 | 1726 |
| |
1722 | 1727 |
| |
|
Lines changed: 7 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
252 | 252 |
| |
253 | 253 |
| |
254 | 254 |
| |
255 |
| - | |
| 255 | + | |
256 | 256 |
| |
257 | 257 |
| |
258 | 258 |
| |
259 | 259 |
| |
260 | 260 |
| |
261 |
| - | |
| 261 | + | |
262 | 262 |
| |
263 | 263 |
| |
264 | 264 |
| |
| |||
271 | 271 |
| |
272 | 272 |
| |
273 | 273 |
| |
274 |
| - | |
| 274 | + | |
275 | 275 |
| |
276 | 276 |
| |
277 | 277 |
| |
| |||
755 | 755 |
| |
756 | 756 |
| |
757 | 757 |
| |
758 |
| - | |
| 758 | + | |
759 | 759 |
| |
760 | 760 |
| |
761 | 761 |
| |
762 |
| - | |
| 762 | + | |
763 | 763 |
| |
764 | 764 |
| |
765 | 765 |
| |
| |||
772 | 772 |
| |
773 | 773 |
| |
774 | 774 |
| |
775 |
| - | |
| 775 | + | |
| 776 | + | |
776 | 777 |
| |
777 | 778 |
| |
778 | 779 |
| |
|
0 commit comments
Comments
(0)