diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2021-11-03 10:28:52 +0200 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2021-11-03 10:52:38 +0200 |
commit | 6b1b405ebfdce9da47f59d8d4144b1168709fbce (patch) | |
tree | de6392efc4c0ae3b8985c0190ad4f80aa419aab0 /contrib/btree_gist/btree_gist.h | |
parent | ef6f047d2c87b91318364341c058dd6b715951b2 (diff) | |
download | postgresql-6b1b405ebfdce9da47f59d8d4144b1168709fbce.tar.gz postgresql-6b1b405ebfdce9da47f59d8d4144b1168709fbce.zip |
Fix snapshot reference leak if lo_export fails.
If lo_export() fails to open the target file or to write to it, it leaks
the created LargeObjectDesc and its snapshot in the top-transaction
context and resource owner. That's pretty harmless, it's a small leak
after all, but it gives the user a "Snapshot reference leak" warning.
Fix by using a short-lived memory context and no resource owner for
transient LargeObjectDescs that are opened and closed within one function
call. The leak is easiest to reproduce with lo_export() on a directory
that doesn't exist, but in principle the other lo_* functions could also
fail.
Backpatch to all supported versions.
Reported-by: Andrew B
Reviewed-by: Alvaro Herrera
Discussion: https://www.postgresql.org/message-id/32bf767a-2d65-71c4-f170-122f416bab7e@iki.fi
Diffstat (limited to 'contrib/btree_gist/btree_gist.h')
0 files changed, 0 insertions, 0 deletions