mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	Fix NULL pointer access in logical replication workers
From: Petr Jelinek <pjmodos@pjmodos.net>
This commit is contained in:
		@@ -349,10 +349,21 @@ logicalrep_worker_stop(Oid subid)
 | 
			
		||||
 | 
			
		||||
		ResetLatch(&MyProc->procLatch);
 | 
			
		||||
 | 
			
		||||
		/* Check if the worker has started. */
 | 
			
		||||
		/* Check worker status. */
 | 
			
		||||
		LWLockAcquire(LogicalRepWorkerLock, LW_SHARED);
 | 
			
		||||
		worker = logicalrep_worker_find(subid);
 | 
			
		||||
		if (!worker || worker->proc)
 | 
			
		||||
 | 
			
		||||
		/*
 | 
			
		||||
		 * Worker is no longer associated with subscription.  It must have
 | 
			
		||||
		 * exited, nothing more for us to do.
 | 
			
		||||
		 */
 | 
			
		||||
		if (worker->subid == InvalidOid)
 | 
			
		||||
		{
 | 
			
		||||
			LWLockRelease(LogicalRepWorkerLock);
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		/* Worker has assigned proc, so it has started. */
 | 
			
		||||
		if (worker->proc)
 | 
			
		||||
			break;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user