pgsql: Fix snapshot leak if lo_open called on non-existent object.

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix snapshot leak if lo_open called on non-existent object.
Date: 2013-09-30 10:05:57
Message-ID: E1VQaMX-00023q-5q@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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).

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/357f7521384df34c697b3544115622520a6a0e9f

Modified Files
--------------
src/backend/storage/large_object/inv_api.c | 44 ++++++++++++++++------------
1 file changed, 26 insertions(+), 18 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Heikki Linnakangas 2013-09-30 13:56:10 pgsql: In bms_add_member(), use repalloc() if the bms needs to be enlar
Previous Message Andrew Dunstan 2013-09-30 04:08:50 pgsql: Revert "Backpatch pgxs vpath build and installation fixes."