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/interfaces/libpq/fe-exec.c | |
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/interfaces/libpq/fe-exec.c')
-rw-r--r-- | src/interfaces/libpq/fe-exec.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/interfaces/libpq/fe-exec.c b/src/interfaces/libpq/fe-exec.c index 1750d647a8d..51e9a362f6a 100644 --- a/src/interfaces/libpq/fe-exec.c +++ b/src/interfaces/libpq/fe-exec.c @@ -775,12 +775,10 @@ PQclear(PGresult *res) void pqClearAsyncResult(PGconn *conn) { - if (conn->result) - PQclear(conn->result); + PQclear(conn->result); conn->result = NULL; conn->error_result = false; - if (conn->next_result) - PQclear(conn->next_result); + PQclear(conn->next_result); conn->next_result = NULL; } @@ -2437,8 +2435,7 @@ PQexecFinish(PGconn *conn) lastResult = NULL; while ((result = PQgetResult(conn)) != NULL) { - if (lastResult) - PQclear(lastResult); + PQclear(lastResult); lastResult = result; if (result->resultStatus == PGRES_COPY_IN || result->resultStatus == PGRES_COPY_OUT || |