diff options
author | Peter Eisentraut <peter@eisentraut.org> | 2022-07-03 20:11:05 +0200 |
---|---|---|
committer | Peter Eisentraut <peter@eisentraut.org> | 2022-07-03 20:11:05 +0200 |
commit | 5faef9d582012433db9ad05af27a77bd591508e1 (patch) | |
tree | f3ace999fcaf45d69c3eb8428d3afc4819316530 /src/bin/psql | |
parent | 02c408e21a6e78ff246ea7a1beb4669634fa9c4c (diff) | |
download | postgresql-5faef9d582012433db9ad05af27a77bd591508e1.tar.gz postgresql-5faef9d582012433db9ad05af27a77bd591508e1.zip |
Remove redundant null pointer checks before PQclear and PQconninfoFree
These functions already had the free()-like behavior of handling null
pointers as a no-op. But it wasn't documented, so add it explicitly
to the documentation, too.
Discussion: https://www.postgresql.org/message-id/flat/dac5d2d0-98f5-94d9-8e69-46da2413593d%40enterprisedb.com
Diffstat (limited to 'src/bin/psql')
-rw-r--r-- | src/bin/psql/command.c | 3 | ||||
-rw-r--r-- | src/bin/psql/common.c | 3 | ||||
-rw-r--r-- | src/bin/psql/describe.c | 3 |
3 files changed, 3 insertions, 6 deletions
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index f3c5196c901..c562c04afee 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -3476,8 +3476,7 @@ do_connect(enum trivalue reuse_previous_specification, /* Release locally allocated data, whether we succeeded or not */ pg_free(password); - if (cinfo) - PQconninfoFree(cinfo); + PQconninfoFree(cinfo); if (!success) { diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 974959c5959..9f95869eca6 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -463,8 +463,7 @@ ClearOrSaveResult(PGresult *result) { case PGRES_NONFATAL_ERROR: case PGRES_FATAL_ERROR: - if (pset.last_error_result) - PQclear(pset.last_error_result); + PQclear(pset.last_error_result); pset.last_error_result = result; break; diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index 2df95bc1654..88d92a08ae6 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -3492,8 +3492,7 @@ error_return: free(view_def); - if (res) - PQclear(res); + PQclear(res); return retval; } |