commit 689fb8b470f19fb83ee1e32efe64b42d6961630c
parent 59d19b9894083cecafc4439f7df1031bd6cefb01
Author: Charles E. Lehner <cel@celehner.com>
Date: Thu, 24 Sep 2020 11:44:57 -0400
Close fd after freeing SSL
BIO_free_all may trigger write to close the SSL connection
Diffstat:
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/client.c b/src/client.c
@@ -236,11 +236,6 @@ gemini_response_finish(struct gemini_response *resp)
return;
}
- if (resp->fd != -1) {
- close(resp->fd);
- resp->fd = -1;
- }
-
if (resp->bio) {
BIO_free_all(resp->bio);
resp->bio = NULL;
@@ -254,6 +249,11 @@ gemini_response_finish(struct gemini_response *resp)
}
free(resp->meta);
+ if (resp->fd != -1) {
+ close(resp->fd);
+ resp->fd = -1;
+ }
+
resp->ssl = NULL;
resp->ssl_ctx = NULL;
resp->meta = NULL;