diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c
index 01eabe5..d814229 100644
--- a/src/backend/storage/buffer/bufmgr.c
+++ b/src/backend/storage/buffer/bufmgr.c
@@ -2473,7 +2473,14 @@ AtProcExit_Buffers(int code, Datum arg)
 	AbortBufferIO();
 	UnlockBuffers();
 
-	CheckForBufferLeaks();
+	/*
+	 * The startup process might fail to release buffer pins if it fatals out.
+	 * Since that will result in postmaster shutdown anyway, there's not
+	 * really a reason to work hard to prevent it; but let's not raise an
+	 * assertion failure when it happens.
+	 */
+	if (code == 0 || !AmStartupProcess())
+		CheckForBufferLeaks();
 
 	/* localbuf.c needs a chance too */
 	AtProcExit_LocalBuffers();
