]> 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:54:37 +0000 (12:54 +0300)
commitfc7a38f3250d3678fb2f64d8b6a18cd380f1dd6a
tree33bba0b30d05745810b006262e6d1079f9f9b66e
parent59d30d9ff19bcb4e7537b3b44e926939f1cbce58
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