Commit c6605c1
committed
Don't test already-referenced pointer for nullness
Commit b8ba734 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
618c167 (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 b8ba734.
Per Coverity.1 parent a37bb7c commit c6605c1
1 file changed
+3
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
842 | 842 | | |
843 | 843 | | |
844 | 844 | | |
| 845 | + | |
| 846 | + | |
845 | 847 | | |
846 | 848 | | |
847 | 849 | | |
| |||
2138 | 2140 | | |
2139 | 2141 | | |
2140 | 2142 | | |
2141 | | - | |
| 2143 | + | |
2142 | 2144 | | |
2143 | 2145 | | |
2144 | 2146 | | |
| |||
0 commit comments