diff --git a/src/client.c b/src/client.c

index bb508e04c8d41fe12aa99ae42b8fa30d4f3a9a2e..18b5115371bc6b13b9b796a85f7ad4f826eef973 100644

--- a/src/client.c

+++ b/src/client.c

@@ -236,11 +236,6 @@ if (!resp) {

return;

}

- if (resp->fd != -1) {

- close(resp->fd);

- resp->fd = -1;

- }

-

if (resp->bio) {

BIO_free_all(resp->bio);

resp->bio = NULL;

@@ -253,6 +248,11 @@ if (resp->ssl_ctx) {

SSL_CTX_free(resp->ssl_ctx);

}

free(resp->meta);

+

+ if (resp->fd != -1) {

+ close(resp->fd);

+ resp->fd = -1;

+ }

resp->ssl = NULL;

resp->ssl_ctx = NULL;