Fix file descriptor leak after failure of a \setshell command in pgbench.

Tom Lane <tgl@sss.pgh.pa.us>

Commit: 3b750ec155be3b8d658eadd8effe4d3c31955852
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2014-12-16T18:32:02Z
Releases: 9.3.6
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.

Files

PathChange+/−
contrib/pgbench/pgbench.c modified +1 −0