Skip to content

Commit 2ef6c66

Browse files
committed
Fix file descriptor leak at end of recovery.
XLogFileInit() returns a file descriptor, which needs to be closed. The leak was short-lived, since the startup process exits shortly afterwards, but it was clearly a bug, nevertheless. Per Coverity report.
1 parent cfb64fd commit 2ef6c66

File tree

1 file changed

+8
-1
lines changed
  • src/backend/access/transam

1 file changed

+8
-1
lines changed

src/backend/access/transam/xlog.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5043,8 +5043,15 @@ exitArchiveRecovery(TimeLineID endTLI, XLogRecPtr endOfLog)
50435043
else
50445044
{
50455045
bool use_existent = true;
5046+
int fd;
50465047

5047-
XLogFileInit(startLogSegNo, &use_existent, true);
5048+
fd = XLogFileInit(startLogSegNo, &use_existent, true);
5049+
5050+
if (close(fd))
5051+
ereport(ERROR,
5052+
(errcode_for_file_access(),
5053+
errmsg("could not close log file %s: %m",
5054+
XLogFileNameP(ThisTimeLineID, startLogSegNo))));
50485055
}
50495056

50505057
/*

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy