Fix new memory leaks in libpq

My oversight in commit 9aa491abbf.

Per coverity.
This commit is contained in:
Alvaro Herrera 2021-03-21 14:55:27 -03:00
parent 677271a3a1
commit 2b526ed2e1
No known key found for this signature in database
GPG Key ID: 1C20ACB9D5C564AE
1 changed files with 5 additions and 4 deletions

View File

@ -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;
}