pgsql: Fix memory leak in pgbench

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix memory leak in pgbench
Date: 2019-04-09 17:00:15
Message-ID: E1hDu6Z-00010m-Ct@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix memory leak in pgbench

Commit 25ee70511ec2 introduced a memory leak in pgbench: some PGresult
structs were not being freed during error bailout, because we're now
doing more PQgetResult() calls than previously. Since there's more
cleanup code outside the discard_response() routine than in it, refactor
the cleanup code, removing the routine.

This has little effect currently, since we abandon processing after
hitting errors, but if we ever get further pgbench features (such as
testing for serializable transactions), it'll matter.

Per Coverity.

Reviewed-by: Michaël Paquier

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/fe0e0b4fc7f0cdc2333bda08b199422a1e77a551

Modified Files
--------------
src/bin/pgbench/pgbench.c | 48 ++++++++++++++++++-----------------------------
1 file changed, 18 insertions(+), 30 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2019-04-09 17:01:54 pgsql: Fix typo
Previous Message Tom Lane 2019-04-09 15:43:28 pgsql: Test some more cases with partitioned tables in EvalPlanQual.