aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/trigger.c
diff options
context:
space:
mode:
authorTomas Vondra <tomas.vondra@postgresql.org>2023-07-02 18:54:09 +0200
committerTomas Vondra <tomas.vondra@postgresql.org>2023-07-02 20:03:30 +0200
commit98640f960eb9ed80cf90de3ef5d2e829b785b3eb (patch)
tree63c2616ee2fbb7f2b3c66fd0ca2f75f62bb0c459 /src/backend/commands/trigger.c
parent0457109344b46f481f9bf09b85674695ba57c8e4 (diff)
downloadpostgresql-98640f960eb9ed80cf90de3ef5d2e829b785b3eb.tar.gz
postgresql-98640f960eb9ed80cf90de3ef5d2e829b785b3eb.zip
Fix memory leak in Incremental Sort rescans
The Incremental Sort had a couple issues, resulting in leaking memory during rescans, possibly triggering OOM. The code had a couple of related flaws: 1. During rescans, the sort states were reset but then also set to NULL (despite the comment saying otherwise). ExecIncrementalSort then sees NULL and initializes a new sort state, leaking the memory used by the old one. 2. Initializing the sort state also automatically rebuilt the info about presorted keys, leaking the already initialized info. presorted_keys was also unnecessarily reset to NULL. Patch by James Coleman, based on patches by Laurenz Albe and Tom Lane. Backpatch to 13, where Incremental Sort was introduced. Author: James Coleman, Laurenz Albe, Tom Lane Reported-by: Laurenz Albe, Zu-Ming Jiang Backpatch-through: 13 Discussion: https://postgr.es/m/b2bd02dff61af15e3526293e2771f874cf2a3be7.camel%40cybertec.at Discussion: https://postgr.es/m/db03c582-086d-e7cd-d4a1-3bc722f81765%40inf.ethz.ch
Diffstat (limited to 'src/backend/commands/trigger.c')
0 files changed, 0 insertions, 0 deletions