diff options
| author | Peter Eisentraut | 2022-07-03 18:11:05 +0000 |
|---|---|---|
| committer | Peter Eisentraut | 2022-07-03 18:11:05 +0000 |
| commit | 5faef9d582012433db9ad05af27a77bd591508e1 (patch) | |
| tree | f3ace999fcaf45d69c3eb8428d3afc4819316530 /src/interfaces/ecpg | |
| parent | 02c408e21a6e78ff246ea7a1beb4669634fa9c4c (diff) | |
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/ecpg')
| -rw-r--r-- | src/interfaces/ecpg/ecpglib/descriptor.c | 3 | ||||
| -rw-r--r-- | src/interfaces/ecpg/ecpglib/execute.c | 3 |
2 files changed, 2 insertions, 4 deletions
diff --git a/src/interfaces/ecpg/ecpglib/descriptor.c b/src/interfaces/ecpg/ecpglib/descriptor.c index f1898dec6a6..649a71c286c 100644 --- a/src/interfaces/ecpg/ecpglib/descriptor.c +++ b/src/interfaces/ecpg/ecpglib/descriptor.c @@ -923,8 +923,7 @@ ECPGdescribe(int line, int compat, bool input, const char *connection_name, cons if (!ecpg_check_PQresult(res, line, con->connection, compat)) break; - if (desc->result != NULL) - PQclear(desc->result); + PQclear(desc->result); desc->result = res; ret = true; diff --git a/src/interfaces/ecpg/ecpglib/execute.c b/src/interfaces/ecpg/ecpglib/execute.c index 2ebe6656d63..bd94bd4e6c6 100644 --- a/src/interfaces/ecpg/ecpglib/execute.c +++ b/src/interfaces/ecpg/ecpglib/execute.c @@ -1714,8 +1714,7 @@ ecpg_process_output(struct statement *stmt, bool clear_result) status = false; else { - if (desc->result) - PQclear(desc->result); + PQclear(desc->result); desc->result = stmt->results; clear_result = false; ecpg_log("ecpg_process_output on line %d: putting result (%d tuples) into descriptor %s\n", |
