From 02c408e21a6e78ff246ea7a1beb4669634fa9c4c Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Thu, 16 Jun 2022 21:50:56 +0200 Subject: Remove redundant null pointer checks before free() Per applicable standards, free() with a null pointer is a no-op. Systems that don't observe that are ancient and no longer relevant. Some PostgreSQL code already required this behavior, so this change does not introduce any new requirements, just makes the code more consistent. Discussion: https://www.postgresql.org/message-id/flat/dac5d2d0-98f5-94d9-8e69-46da2413593d%40enterprisedb.com --- src/bin/psql/describe.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/bin/psql/describe.c') diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index d1ae6991714..2df95bc1654 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -1786,8 +1786,7 @@ describeOneTableDetails(const char *schemaname, printQuery(res, &myopt, pset.queryFout, false, pset.logfile); - if (footers[0]) - free(footers[0]); + free(footers[0]); retval = true; goto error_return; /* not an error, just return early */ @@ -3491,8 +3490,7 @@ error_return: termPQExpBuffer(&title); termPQExpBuffer(&tmpbuf); - if (view_def) - free(view_def); + free(view_def); if (res) PQclear(res); -- cgit v1.2.3