[patch] Potential relcache leak in get_object_address_attribute

Started by Marti Raudseppalmost 12 years ago2 messages
#1Marti Raudsepp
marti@juffo.org
1 attachment(s)

Hi list,

It looks like the get_object_address_attribute() function has a
potential relcache leak. When missing_ok=true, the relation is found
but attribute is not, then the relation isn't closed, nor is it
returned to the caller.

I couldn't figure out any ways to trigger this, but it's best to fix anyway.

Regards,
Marti

Attachments:

objectaddress_relcache_leak.patchtext/x-patch; charset=US-ASCII; name=objectaddress_relcache_leak.patchDownload
diff --git a/src/backend/catalog/objectaddress.c b/src/backend/catalog/objectaddress.c
index f8fd4f8..e22aa66 100644
--- a/src/backend/catalog/objectaddress.c
+++ b/src/backend/catalog/objectaddress.c
@@ -1024,6 +1024,7 @@ get_object_address_attribute(ObjectType objtype, List *objname,
 		address.classId = RelationRelationId;
 		address.objectId = InvalidOid;
 		address.objectSubId = InvalidAttrNumber;
+		relation_close(relation, lockmode);
 		return address;
 	}
 
#2Robert Haas
robertmhaas@gmail.com
In reply to: Marti Raudsepp (#1)
Re: [patch] Potential relcache leak in get_object_address_attribute

On Sat, Jan 18, 2014 at 7:14 PM, Marti Raudsepp <marti@juffo.org> wrote:

It looks like the get_object_address_attribute() function has a
potential relcache leak. When missing_ok=true, the relation is found
but attribute is not, then the relation isn't closed, nor is it
returned to the caller.

I couldn't figure out any ways to trigger this, but it's best to fix anyway.

I agree. Committed, thanks for the patch.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers