Skip to content
Snippets Groups Projects
Commit 5b2c8f04 authored by Tom Lane's avatar Tom Lane
Browse files

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.
parent cd63c57e
No related branches found
Tags
No related merge requests found
......@@ -749,6 +749,7 @@ runShellCommand(CState *st, char *variable, char **argv, int argc)
{
if (!timer_exceeded)
fprintf(stderr, "%s: cannot read the result\n", argv[0]);
(void) pclose(fp);
return false;
}
if (pclose(fp) < 0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment