BUG #18785: Pointer bmr.rel, dereferenced by passing as 1st parameter to function is checked for NULL later - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #18785: Pointer bmr.rel, dereferenced by passing as 1st parameter to function is checked for NULL later
Date
Msg-id 18785-916b89e64ced06e1@postgresql.org
Whole thread Raw
Responses Re: BUG #18785: Pointer bmr.rel, dereferenced by passing as 1st parameter to function is checked for NULL later
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      18785
Logged by:          Daniel Elishakov
Email address:      dan-eli@mail.ru
PostgreSQL version: 16.6
Operating system:   ubuntu 20.04
Description:

Hello, I suggest the following patch for this issue.

@@ -905,6 +905,8 @@ ExtendBufferedRelTo(BufferManagerRelation bmr,
                 bmr.smgr->smgr_cached_nblocks[fork] == InvalidBlockNumber)
&&
                !smgrexists(bmr.smgr, fork))
        {
+
+               Assert(bmr.rel != NULL);
                LockRelationForExtension(bmr.rel, ExclusiveLock);
 
                /* could have been closed while waiting for lock */


I think we need to check bmr.rel for NULL, because Asserts above do not
suggest bmr.rel != NULL. Moreover, it is being checked for NULL later after
being passed into function LockRelationForExtension(bmr.rel, ExclusiveLock);


pgsql-bugs by date:

Previous
From: 安藤勇次
Date:
Subject: Re: reltuples kept decreasing with each autovacuum run Re: BUG #18773: オートバキュームのリトライ時にreltuplesの値が減少する
Next
From: PG Bug reporting form
Date:
Subject: BUG #18786: Pointer bmr.rel, dereferenced by passing as 1st parameter to function is checked for NULL later