pgsql: Remove memory leaks in isolationtester.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Remove memory leaks in isolationtester.
Date: 2021-06-27 16:45:29
Message-ID: E1lxXuT-0005kg-2W@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Remove memory leaks in isolationtester.

specscanner.l leaked a kilobyte of memory per token of the spec file.
Apparently somebody thought that the introductory code block would be
executed once; but it's once per yylex() call.

A couple of functions in isolationtester.c leaked small amounts of
memory due to not bothering to free one-time allocations. Might
as well improve these so that valgrind gives this program a clean
bill of health. Also get rid of an ugly static variable.

Coverity complained about one of the one-time leaks, which led me
to try valgrind'ing isolationtester, which led to discovery of the
larger leak.

Branch
------
REL_12_STABLE

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

Modified Files
--------------
src/test/isolation/isolationtester.c | 20 +++++++++++++-------
src/test/isolation/specscanner.l | 8 ++++++--
2 files changed, 19 insertions(+), 9 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2021-06-28 01:46:17 pgsql: Make index_set_state_flags() transactional
Previous Message Peter Eisentraut 2021-06-27 07:48:38 pgsql: Error message refactoring