From 689fb8b470f19fb83ee1e32efe64b42d6961630c Mon Sep 17 00:00:00 2001 From: "Charles E. Lehner" Date: Thu, 24 Sep 2020 11:44:57 -0400 Subject: [PATCH] Close fd after freeing SSL BIO_free_all may trigger write to close the SSL connection --- src/client.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/client.c b/src/client.c index bb508e0..18b5115 100644 --- 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;