]> granicus.if.org Git - postgresql/commit
Fix file descriptor leak after failure of a \setshell command in pgbench.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 16 Dec 2014 18:31:42 +0000 (13:31 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 16 Dec 2014 18:32:15 +0000 (13:32 -0500)
commit5b2c8f04a7cdf161f09ed45c235f0eebf3d88f0d
treef3e1f8230f631cb009b44f1d126dcad55655b57b
parentcd63c57e5cbfc16239aa6837f8b7043a721cdd28
Fix file descriptor leak after failure of a \setshell command in pgbench.

If the called command fails to return data, runShellCommand forgot to
pclose() the pipe before returning.  This is fairly harmless in the current
code, because pgbench would then abandon further processing of that client
thread; so no more than nclients descriptors could be leaked this way.  But
it's not hard to imagine future improvements whereby that wouldn't be true.
In any case, it's sloppy coding, so patch all branches.  Found by Coverity.
contrib/pgbench/pgbench.c