diff options
author | Peter Eisentraut <peter@eisentraut.org> | 2022-06-16 21:50:56 +0200 |
---|---|---|
committer | Peter Eisentraut <peter@eisentraut.org> | 2022-07-03 11:47:15 +0200 |
commit | 02c408e21a6e78ff246ea7a1beb4669634fa9c4c (patch) | |
tree | 7e4cf03f3de7e32af266b739e12c6600d871ed45 /src/interfaces/libpq/fe-exec.c | |
parent | 098c703d308fa88dc9e3f9f623ca023ce4717794 (diff) | |
download | postgresql-02c408e21a6e78ff246ea7a1beb4669634fa9c4c.tar.gz postgresql-02c408e21a6e78ff246ea7a1beb4669634fa9c4c.zip |
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
Diffstat (limited to 'src/interfaces/libpq/fe-exec.c')
-rw-r--r-- | src/interfaces/libpq/fe-exec.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/interfaces/libpq/fe-exec.c b/src/interfaces/libpq/fe-exec.c index 919cf5741d4..1750d647a8d 100644 --- a/src/interfaces/libpq/fe-exec.c +++ b/src/interfaces/libpq/fe-exec.c @@ -742,8 +742,7 @@ PQclear(PGresult *res) free(res->events[i].name); } - if (res->events) - free(res->events); + free(res->events); /* Free all the subsidiary blocks */ while ((block = res->curBlock) != NULL) @@ -753,8 +752,7 @@ PQclear(PGresult *res) } /* Free the top-level tuple pointer array */ - if (res->tuples) - free(res->tuples); + free(res->tuples); /* zero out the pointer fields to catch programming errors */ res->attDescs = NULL; |