summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2019-09-20 12:39:30 -0700
committerdormando <dormando@rydia.net>2019-09-28 00:32:33 -0700
commit06d06ff9477780d82ef3a1851525e3bc2aa4280f (patch)
tree1d786e6fc25d3441a6c938e4d406edbd245a5204 /thread.c
parent480fc665c3505336c37afb242e3412c75b3ac30c (diff)
downloadmemcached-06d06ff9477780d82ef3a1851525e3bc2aa4280f.tar.gz
TLS: fix leak of SSL context on accept failure
frees said context. Don't use SSL_Shutdown as connection was not established. also fixes potential leak if dispatch_conn_new fails; but that shouldn't be possible for most systems. requires either a malloc failure or event_add() failure.
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/thread.c b/thread.c
index f3a08ad..eaec647 100644
--- a/thread.c
+++ b/thread.c
@@ -500,6 +500,12 @@ static void thread_libevent_process(int fd, short which, void *arg) {
fprintf(stderr, "Can't listen for events on fd %d\n",
item->sfd);
}
+#ifdef TLS
+ if (item->ssl) {
+ SSL_shutdown(item->ssl);
+ SSL_free(item->ssl);
+ }
+#endif
close(item->sfd);
}
} else {