Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7a7c8c9

Browse files
committed
Don't test already-referenced pointer for nullness
Commitb8ba734 added in PQgetResult a derefence to a pointerreturned by pqPrepareAsyncResult(), before some other code that wasalready testing that pointer for nullness. But since commit618c167 (in Postgres 15), pqPrepareAsyncResult() doesn't everreturn NULL (a statically-allocated result is returned if OOM). So inbranches 15 and up, we can remove the redundant pointer check with noharm done.However, in branch 14, pqPrepareAsyncResult() can indeed return NULL ifit runs out of memory. Fix things there by adding a null pointer checkbefore dereferencing the pointer. This should hint Coverity that thepreexisting check is not redundant but necessary.Backpatch to 14, likeb8ba734.Per Coverity.
1 parentc7edaee commit7a7c8c9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

‎src/interfaces/libpq/fe-exec.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2091,8 +2091,9 @@ PQgetResult(PGconn *conn)
20912091
res=pqPrepareAsyncResult(conn);
20922092

20932093
/* Advance the queue as appropriate */
2094-
pqCommandQueueAdvance(conn, false,
2095-
res->resultStatus==PGRES_PIPELINE_SYNC);
2094+
if (res)
2095+
pqCommandQueueAdvance(conn, false,
2096+
res->resultStatus==PGRES_PIPELINE_SYNC);
20962097

20972098
if (conn->pipelineStatus!=PQ_PIPELINE_OFF)
20982099
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp