1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-02 09:02:37 +03:00

Minor pg_dump improvements

Improve pg_dump by checking results on various fgetc() calls which
previously were unchecked, ditto for ftello.  Also clean up a couple
of very minor memory leaks by waiting to allocate structures until
after the initial check(s).

Issues spotted by Coverity.
This commit is contained in:
Stephen Frost
2014-02-08 21:25:47 -05:00
parent 66c04c981d
commit cfa1b4a711
3 changed files with 31 additions and 9 deletions

View File

@ -708,6 +708,9 @@ _CloseArchive(ArchiveHandle *AH)
{
WriteHead(AH);
tpos = ftello(AH->FH);
if (tpos < 0 || errno)
exit_horribly(modulename, "could not determine seek position in archive file: %s\n",
strerror(errno));
WriteToc(AH);
ctx->dataStart = _getFilePos(AH, ctx);
WriteDataChunks(AH, NULL);
@ -756,7 +759,7 @@ _ReopenArchive(ArchiveHandle *AH)
errno = 0;
tpos = ftello(AH->FH);
if (errno)
if (tpos < 0 || errno)
exit_horribly(modulename, "could not determine seek position in archive file: %s\n",
strerror(errno));