Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 990be8e

Browse files
committed
Fix libpq compression if no algorithms are available
1 parent fc16bf6 commit 990be8e

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/interfaces/libpq/fe-connect.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -431,10 +431,12 @@ pgthreadlock_t pg_g_threadlock = default_threadlock;
431431
void
432432
pqDropConnection(PGconn *conn, bool flushInput)
433433
{
434-
/* Release compression streams */
435-
zpq_free(conn->zstream);
436-
conn->zstream = NULL;
437-
434+
if (conn->zstream)
435+
{
436+
/* Release compression streams */
437+
zpq_free(conn->zstream);
438+
conn->zstream = NULL;
439+
}
438440
/* Drop any SSL state */
439441
pqsecure_close(conn);
440442

src/interfaces/libpq/fe-misc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ pqSendSome(PGconn *conn, int len)
898898
}
899899

900900
/* while there's still data to send */
901-
while (len > 0 || zpq_buffered(conn->zstream))
901+
while (len > 0 || (conn->zstream && zpq_buffered(conn->zstream)))
902902
{
903903
int sent;
904904
size_t processed = 0;
@@ -964,7 +964,7 @@ pqSendSome(PGconn *conn, int len)
964964
remaining -= sent;
965965
}
966966

967-
if (len > 0 || sent < 0 || zpq_buffered(conn->zstream))
967+
if (len > 0 || sent < 0 || (conn->zstream && zpq_buffered(conn->zstream)))
968968
{
969969
/*
970970
* We didn't send it all, wait till we can send more.

0 commit comments

Comments
 (0)