Skip to content

Commit 2b526ed

Browse files
committed
Fix new memory leaks in libpq
My oversight in commit 9aa491a. Per coverity.
1 parent 677271a commit 2b526ed

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/interfaces/libpq/fe-exec.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,10 +1299,6 @@ PQsendQueryInternal(PGconn *conn, const char *query, bool newQuery)
12991299
if (!PQsendQueryStart(conn, newQuery))
13001300
return 0;
13011301

1302-
entry = pqAllocCmdQueueEntry(conn);
1303-
if (entry == NULL)
1304-
return 0; /* error msg already set */
1305-
13061302
/* check the argument */
13071303
if (!query)
13081304
{
@@ -1311,6 +1307,10 @@ PQsendQueryInternal(PGconn *conn, const char *query, bool newQuery)
13111307
return 0;
13121308
}
13131309

1310+
entry = pqAllocCmdQueueEntry(conn);
1311+
if (entry == NULL)
1312+
return 0; /* error msg already set */
1313+
13141314
/* Send the query message(s) */
13151315
if (conn->pipelineStatus == PQ_PIPELINE_OFF)
13161316
{
@@ -1320,6 +1320,7 @@ PQsendQueryInternal(PGconn *conn, const char *query, bool newQuery)
13201320
pqPutMsgEnd(conn) < 0)
13211321
{
13221322
/* error message should be set up already */
1323+
pqRecycleCmdQueueEntry(conn, entry);
13231324
return 0;
13241325
}
13251326

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy