1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-26 12:21:12 +03:00

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.
This commit is contained in:
Heikki Linnakangas
2014-12-21 21:49:03 +02:00
parent cfb64fde7b
commit 2ef6c66a2b

View File

@ -5043,8 +5043,15 @@ exitArchiveRecovery(TimeLineID endTLI, XLogRecPtr endOfLog)
else
{
bool use_existent = true;
int fd;
XLogFileInit(startLogSegNo, &use_existent, true);
fd = XLogFileInit(startLogSegNo, &use_existent, true);
if (close(fd))
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not close log file %s: %m",
XLogFileNameP(ThisTimeLineID, startLogSegNo))));
}
/*