aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-04-08 04:37:07 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-04-08 04:37:07 +0000
commited845c7374889c879ef886c9584da8ea30114679 (patch)
tree30f10a2d79781baf34fe54dd19b5586af368c529 /src
parentf0a2fc38aba0ebe5e8b0c48d45cba3fbc9b442b4 (diff)
downloadpostgresql-ed845c7374889c879ef886c9584da8ea30114679.tar.gz
postgresql-ed845c7374889c879ef886c9584da8ea30114679.zip
Fix relcache refcount leakage when inv_drop is applied
to a non-LO relation.
Diffstat (limited to 'src')
-rw-r--r--src/backend/storage/large_object/inv_api.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/backend/storage/large_object/inv_api.c b/src/backend/storage/large_object/inv_api.c
index ac57aaef6b2..e5c1f56dac8 100644
--- a/src/backend/storage/large_object/inv_api.c
+++ b/src/backend/storage/large_object/inv_api.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.65 2000/01/26 05:56:59 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.66 2000/04/08 04:37:07 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -278,10 +278,20 @@ inv_drop(Oid lobjId)
{
Relation r;
- r = (Relation) RelationIdGetRelation(lobjId);
- if (!RelationIsValid(r) || r->rd_rel->relkind != RELKIND_LOBJECT)
+ r = RelationIdGetRelation(lobjId);
+ if (!RelationIsValid(r))
return -1;
+ if (r->rd_rel->relkind != RELKIND_LOBJECT)
+ {
+ /* drop relcache refcount from RelationIdGetRelation */
+ RelationDecrementReferenceCount(r);
+ return -1;
+ }
+
+ /* Since heap_drop_with_catalog will destroy the relcache entry,
+ * there's no need to drop the refcount in this path.
+ */
heap_drop_with_catalog(RelationGetRelationName(r));
return 1;
}