On 18.10.2012 22:15, Alvaro Herrera wrote:
Dave Vitek wrote:

Heikki,

It's happy about the overruns.  It did flag an issue where the file
descriptor can leak when the various early returns get taken.

This is a common problem with static analysers; they don't realise we
don't care about the leaked resource because the program is shortly
going to terminate anyway.  We (used to?) have plenty of false positives
in initdb as reported in the Coverity scanner, for example.

Actually, this was a real leak. I should've put close() calls to the cases where the file is empty, or fstat() fails. It doesn't matter when the function is called only once, but in the "pg_ctl start -w" case it's called repeatedly to poll for postmaster startup.

Fixed, and I also changed it to not return the last line if it doesn't end in a newline, per Tom's suggestion.

- Heikki


--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Reply via email to