mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	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.
This commit is contained in:
		@@ -362,17 +362,15 @@ XLogPrefetcher *
 | 
			
		||||
XLogPrefetcherAllocate(XLogReaderState *reader)
 | 
			
		||||
{
 | 
			
		||||
	XLogPrefetcher *prefetcher;
 | 
			
		||||
	const HASHCTL hash_table_ctl = {
 | 
			
		||||
		.keysize = sizeof(RelFileLocator),
 | 
			
		||||
		.entrysize = sizeof(XLogPrefetcherFilter)
 | 
			
		||||
	};
 | 
			
		||||
	HASHCTL ctl;
 | 
			
		||||
 | 
			
		||||
	prefetcher = palloc0(sizeof(XLogPrefetcher));
 | 
			
		||||
 | 
			
		||||
	prefetcher->reader = reader;
 | 
			
		||||
 | 
			
		||||
	ctl.keysize = sizeof(RelFileLocator);
 | 
			
		||||
	ctl.entrysize = sizeof(XLogPrefetcherFilter);
 | 
			
		||||
	prefetcher->filter_table = hash_create("XLogPrefetcherFilterTable", 1024,
 | 
			
		||||
										   &hash_table_ctl,
 | 
			
		||||
										   HASH_ELEM | HASH_BLOBS);
 | 
			
		||||
										   &ctl, HASH_ELEM | HASH_BLOBS);
 | 
			
		||||
	dlist_init(&prefetcher->filter_queue);
 | 
			
		||||
 | 
			
		||||
	SharedStats->wal_distance = 0;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user