aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/interfaces/libpq/fe-exec.c4
-rw-r--r--src/interfaces/libpq/fe-secure-openssl.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/src/interfaces/libpq/fe-exec.c b/src/interfaces/libpq/fe-exec.c
index 9c465b1f967..feb5085ce57 100644
--- a/src/interfaces/libpq/fe-exec.c
+++ b/src/interfaces/libpq/fe-exec.c
@@ -3267,6 +3267,8 @@ PQsetnonblocking(PGconn *conn, int arg)
int
PQisnonblocking(const PGconn *conn)
{
+ if (!conn || conn->status == CONNECTION_BAD)
+ return false;
return pqIsnonblocking(conn);
}
@@ -3286,6 +3288,8 @@ PQisthreadsafe(void)
int
PQflush(PGconn *conn)
{
+ if (!conn || conn->status == CONNECTION_BAD)
+ return -1;
return pqFlush(conn);
}
diff --git a/src/interfaces/libpq/fe-secure-openssl.c b/src/interfaces/libpq/fe-secure-openssl.c
index 196737563df..26615a1aa42 100644
--- a/src/interfaces/libpq/fe-secure-openssl.c
+++ b/src/interfaces/libpq/fe-secure-openssl.c
@@ -1747,7 +1747,7 @@ err:
int
PQdefaultSSLKeyPassHook_OpenSSL(char *buf, int size, PGconn *conn)
{
- if (conn->sslpassword)
+ if (conn && conn->sslpassword)
{
if (strlen(conn->sslpassword) + 1 > size)
fprintf(stderr, libpq_gettext("WARNING: sslpassword truncated\n"));