From: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Don't test already-referenced pointer for nullness |
Date: | 2024-01-16 11:30:15 |
Message-ID: | E1rPhe3-001fwG-Em@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Don't test already-referenced pointer for nullness
Commit b8ba7344e9eb added in PQgetResult a derefence to a pointer
returned by pqPrepareAsyncResult(), before some other code that was
already testing that pointer for nullness. But since commit
618c16707a6d (in Postgres 15), pqPrepareAsyncResult() doesn't ever
return NULL (a statically-allocated result is returned if OOM). So in
branches 15 and up, we can remove the redundant pointer check with no
harm done.
However, in branch 14, pqPrepareAsyncResult() can indeed return NULL if
it runs out of memory. Fix things there by adding a null pointer check
before dereferencing the pointer. This should hint Coverity that the
preexisting check is not redundant but necessary.
Backpatch to 14, like b8ba7344e9eb.
Per Coverity.
Branch
------
REL_14_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/7a7c8c98a610418ed0118e22a1793bf27e55783a
Modified Files
--------------
src/interfaces/libpq/fe-exec.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2024-01-16 11:49:42 | pgsql: struct XmlTableRoutine: use C99 designated initializers |
Previous Message | Peter Eisentraut | 2024-01-16 08:50:40 | pgsql: doc: Decorate PostgreSQL with productname tag |