Content-Length: 270673 | pFad | http://github.com/postgrespro/postgres/commit/2ef6c66a2b1ed288a5e4448989d4b85082d22736

63 Fix file descriptor leak at end of recovery. · postgrespro/postgres@2ef6c66 · GitHub
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)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/2ef6c66a2b1ed288a5e4448989d4b85082d22736

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy