pgsql: Avoid useless malloc/free traffic around getFormattedTypeName(). - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Avoid useless malloc/free traffic around getFormattedTypeName().
Date
Msg-id E1mO2xW-0001d8-9g@gemulon.postgresql.org
Whole thread Raw
List 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_13_STABLE

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

Modified Files
--------------
src/bin/pg_dump/pg_dump.c | 74 +++++++++++++++++++----------------------------
1 file changed, 29 insertions(+), 45 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Fix misleading comments about TOAST access macros.
Next
From: Michael Paquier
Date:
Subject: pgsql: Make shared_memory_size a preset option