Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlvaro Herrera2021-03-21 17:55:27 +0000
committerAlvaro Herrera2021-03-21 17:55:27 +0000
commit2b526ed2e1cbaa54e5ad0c12d1294482f2757b17 (patch)
treeaa0b0ba3c71f287eb616da18618fe053d5711825 /src/interfaces/libpq/fe-exec.c
parent677271a3a125e294b33b891669f594a2c8cb36ce (diff)
Fix new memory leaks in libpq
My oversight in commit 9aa491abbf07. Per coverity.
Diffstat (limited to 'src/interfaces/libpq/fe-exec.c')
-rw-r--r--src/interfaces/libpq/fe-exec.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/interfaces/libpq/fe-exec.c b/src/interfaces/libpq/fe-exec.c
index f3443708a6b..f143b8b7fb8 100644
--- a/src/interfaces/libpq/fe-exec.c
+++ b/src/interfaces/libpq/fe-exec.c
@@ -1299,10 +1299,6 @@ PQsendQueryInternal(PGconn *conn, const char *query, bool newQuery)
if (!PQsendQueryStart(conn, newQuery))
return 0;
- entry = pqAllocCmdQueueEntry(conn);
- if (entry == NULL)
- return 0; /* error msg already set */
-
/* check the argument */
if (!query)
{
@@ -1311,6 +1307,10 @@ PQsendQueryInternal(PGconn *conn, const char *query, bool newQuery)
return 0;
}
+ entry = pqAllocCmdQueueEntry(conn);
+ if (entry == NULL)
+ return 0; /* error msg already set */
+
/* Send the query message(s) */
if (conn->pipelineStatus == PQ_PIPELINE_OFF)
{
@@ -1320,6 +1320,7 @@ PQsendQueryInternal(PGconn *conn, const char *query, bool newQuery)
pqPutMsgEnd(conn) < 0)
{
/* error message should be set up already */
+ pqRecycleCmdQueueEntry(conn, entry);
return 0;
}