pgsql: Be sure to close() file descriptor on error case

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Be sure to close() file descriptor on error case
Date: 2013-07-14 21:31:16
Message-ID: E1UyTsy-0000Ha-R5@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Be sure to close() file descriptor on error case

In receivelog.c:writeTimeLineHistoryFile(), we were not properly
closing the open'd file descriptor in error cases. While this
wouldn't matter much if we were about to exit due to such an
error, that's not the case with pg_receivexlog as it can be a
long-running process and these errors are non-fatal.

This resource leak was found by the Coverity scanner.

Back-patch to 9.3 where this issue first appeared.

Branch
------
REL9_3_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/b68a1fc7ff1a50a7282e8edff7c51333274c3334

Modified Files
--------------
src/bin/pg_basebackup/receivelog.c | 2 ++
1 file changed, 2 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Stephen Frost 2013-07-14 21:47:41 pgsql: Fix resource leak in initdb -X option
Previous Message Stephen Frost 2013-07-14 21:31:11 pgsql: Be sure to close() file descriptor on error case