]> granicus.if.org Git - postgresql/commit
Fix snapshot leak if lo_open called on non-existent object.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Mon, 30 Sep 2013 08:29:09 +0000 (11:29 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Mon, 30 Sep 2013 09:58:51 +0000 (12:58 +0300)
commitc5c87f065d46eed92f7957ee71f2d81867077867
tree3c77de268e0c2aedc6fa6f859f11da0fdafdbe27
parentca4ac3f6c4fca27d9be1ca880c0a32921017855a
Fix snapshot leak if lo_open called on non-existent object.

lo_open registers the currently active snapshot, and checks if the
large object exists after that. Normally, snapshots registered by lo_open
are unregistered at end of transaction when the lo descriptor is closed, but
if we error out before the lo descriptor is added to the list of open
descriptors, it is leaked. Fix by moving the snapshot registration to after
checking if the large object exists.

Reported by Pavel Stehule. Backpatch to 8.4. The snapshot registration
system was introduced in 8.4, so prior versions are not affected (and not
supported, anyway).
src/backend/storage/large_object/inv_api.c