Skip to content

Commit f011e82

Browse files
committed
Initialize HASHCTL differently, to suppress Coverity warning
Coverity complained that the hash_create() call might access hash_table_ctl->hctl. That's a false alarm, hash_create() only accesses that field when passed the HASH_SHARED_MEM flag. Try to silence it by using a plain local variable instead of a const. That's how the HASHCTL is initialized in all the other hash_create() calls.
1 parent b2be5cb commit f011e82

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/backend/access/transam/xlogprefetcher.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -362,17 +362,15 @@ XLogPrefetcher *
362362
XLogPrefetcherAllocate(XLogReaderState *reader)
363363
{
364364
XLogPrefetcher *prefetcher;
365-
const HASHCTL hash_table_ctl = {
366-
.keysize = sizeof(RelFileLocator),
367-
.entrysize = sizeof(XLogPrefetcherFilter)
368-
};
365+
HASHCTL ctl;
369366

370367
prefetcher = palloc0(sizeof(XLogPrefetcher));
371-
372368
prefetcher->reader = reader;
369+
370+
ctl.keysize = sizeof(RelFileLocator);
371+
ctl.entrysize = sizeof(XLogPrefetcherFilter);
373372
prefetcher->filter_table = hash_create("XLogPrefetcherFilterTable", 1024,
374-
&hash_table_ctl,
375-
HASH_ELEM | HASH_BLOBS);
373+
&ctl, HASH_ELEM | HASH_BLOBS);
376374
dlist_init(&prefetcher->filter_queue);
377375

378376
SharedStats->wal_distance = 0;

0 commit comments

Comments
 (0)