File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -431,10 +431,12 @@ pgthreadlock_t pg_g_threadlock = default_threadlock;
431431void
432432pqDropConnection (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
Original file line number Diff line number Diff 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.
You can’t perform that action at this time.
0 commit comments