1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Properly close files after read file failure to prevent potential

resource leak.  Of course, any such failure aborts pg_upgrade, but might
as well be clean about it.

Per patch from Grzegorz Ja?kiewicz.
This commit is contained in:
Bruce Momjian
2010-09-28 19:25:13 +00:00
parent 3fe9f0e5c7
commit c767c3bd36
2 changed files with 6 additions and 0 deletions

View File

@ -103,7 +103,10 @@ getPageVersion(migratorContext *ctx, uint16 *version, const char *pathName)
return "can't open relation";
if ((bytesRead = read(relfd, &page, sizeof(page))) != sizeof(page))
{
close(relfd);
return "can't read page header";
}
*version = PageGetPageLayoutVersion(&page);