提交 393e828e 编写于 作者: R Robert Haas

Avoid potential relcache leak in objectaddress.c.

Nobody using the missing_ok flag yet, but let's speculate that this will
be a better interface for future callers.

KaiGai Kohei, with some adjustments by me.
上级 ad30d366
......@@ -639,6 +639,7 @@ get_object_address_relobject(ObjectType objtype, List *objname,
* Caller is expecting to get back the relation, even though we
* didn't end up using it to find the rule.
*/
if (OidIsValid(address.objectId))
relation = heap_open(reloid, AccessShareLock);
}
else
......@@ -677,6 +678,14 @@ get_object_address_relobject(ObjectType objtype, List *objname,
address.objectId = InvalidOid;
address.objectSubId = 0;
}
/* Avoid relcache leak when object not found. */
if (!OidIsValid(address.objectId))
{
heap_close(relation, AccessShareLock);
relation = NULL; /* department of accident prevention */
return address;
}
}
/* Done. */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册