1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-25 13:17:41 +03:00

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
This commit is contained in:
Peter Eisentraut
2022-07-03 20:11:05 +02:00
parent 02c408e21a
commit 5faef9d582
13 changed files with 29 additions and 48 deletions

View File

@@ -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;

View File

@@ -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",