diff --git a/src/client.c b/src/client.c
index 07460f917b153b0d368eb2a98f368aa6a5df56a4..2d39f56cb8e45f7b708e5a5dea1ec6fa84e188c9 100644
--- a/src/client.c
+++ b/src/client.c
@@ -240,7 +240,9 @@ BIO_free(resp->bio); // buffered bio
resp->bio = NULL;
}
- SSL_free(resp->ssl);
+ if (resp->ssl) {
+ SSL_free(resp->ssl);
+ }
SSL_CTX_free(resp->ssl_ctx);
free(resp->meta);