Skip to content

Commit 998d100

Browse files
committed
Fix some near-bugs related to ResourceOwner function arguments
These functions took a ResourceOwner argument, but only checked if it was NULL, and then used CurrentResourceOwner for the actual work. Surely the intention was to use the passed-in resource owner. All current callers passed CurrentResourceOwner or NULL, so this has no consequences at the moment, but it's an accident waiting to happen for future caller and extensions. Author: Matthias van de Meent <boekewurm+postgres@gmail.com> Discussion: https://www.postgresql.org/message-id/CAEze2Whnfv8VuRZaohE-Af+GxBA1SNfD_rXfm84Jv-958UCcJA@mail.gmail.com Backpatch-through: 17
1 parent d0518e9 commit 998d100

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/backend/utils/cache/catcache.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1638,7 +1638,7 @@ ReleaseCatCacheWithOwner(HeapTuple tuple, ResourceOwner resowner)
16381638

16391639
ct->refcount--;
16401640
if (resowner)
1641-
ResourceOwnerForgetCatCacheRef(CurrentResourceOwner, &ct->tuple);
1641+
ResourceOwnerForgetCatCacheRef(resowner, &ct->tuple);
16421642

16431643
if (
16441644
#ifndef CATCACHE_FORCE_RELEASE
@@ -2083,7 +2083,7 @@ ReleaseCatCacheListWithOwner(CatCList *list, ResourceOwner resowner)
20832083
Assert(list->refcount > 0);
20842084
list->refcount--;
20852085
if (resowner)
2086-
ResourceOwnerForgetCatCacheListRef(CurrentResourceOwner, list);
2086+
ResourceOwnerForgetCatCacheListRef(resowner, list);
20872087

20882088
if (
20892089
#ifndef CATCACHE_FORCE_RELEASE

0 commit comments

Comments
 (0)