mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-15 08:20:16 +08:00
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.
This commit is contained in:
parent
c8315930e6
commit
d38e8d30ce
@ -958,6 +958,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)
|
||||
|
Loading…
Reference in New Issue
Block a user