pgsql: Avoid useless malloc/free traffic around getFormattedTypeName().

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Avoid useless malloc/free traffic around getFormattedTypeName().
Date: 2021-09-08 19:10:10
Message-ID: E1mO2xW-0001dA-A3@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Avoid useless malloc/free traffic around getFormattedTypeName().

Coverity complained that one caller of getFormattedTypeName() failed
to free the returned string. Which is true, but rather than fixing
that one, let's get rid of this tedious and error-prone requirement.
Now that getFormattedTypeName() caches its result, strdup'ing that
result and expecting the caller to free it accomplishes little except
to waste cycles. We do create a leak in the case where getTypes didn't
make a TypeInfo for the type, but that basically shouldn't ever happen.

Back-patch, as commit 6c450a861 was. This isn't a particularly
interesting bug fix, but the API change seems like a hazard for
future back-patching activity if we don't back-patch it.

Branch
------
REL_12_STABLE

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

Modified Files
--------------
src/bin/pg_dump/pg_dump.c | 78 +++++++++++++++++++----------------------------
1 file changed, 31 insertions(+), 47 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2021-09-09 01:09:42 pgsql: Make shared_memory_size a preset option
Previous Message Tom Lane 2021-09-08 18:11:43 pgsql: Fix misleading comments about TOAST access macros.