Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit393e828

Browse files
committed
Avoid potential relcache leak in objectaddress.c.
Nobody using the missing_ok flag yet, but let's speculate that this willbe a better interface for future callers.KaiGai Kohei, with some adjustments by me.
1 parentad30d36 commit393e828

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

‎src/backend/catalog/objectaddress.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,8 @@ get_object_address_relobject(ObjectType objtype, List *objname,
639639
* Caller is expecting to get back the relation, even though we
640640
* didn't end up using it to find the rule.
641641
*/
642-
relation=heap_open(reloid,AccessShareLock);
642+
if (OidIsValid(address.objectId))
643+
relation=heap_open(reloid,AccessShareLock);
643644
}
644645
else
645646
{
@@ -677,6 +678,14 @@ get_object_address_relobject(ObjectType objtype, List *objname,
677678
address.objectId=InvalidOid;
678679
address.objectSubId=0;
679680
}
681+
682+
/* Avoid relcache leak when object not found. */
683+
if (!OidIsValid(address.objectId))
684+
{
685+
heap_close(relation,AccessShareLock);
686+
relation=NULL;/* department of accident prevention */
687+
returnaddress;
688+
}
680689
}
681690

682691
/* Done. */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp