summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2017-10-05 13:30:39 +0300
committerTimo Teräs <timo.teras@iki.fi>2017-10-05 16:59:14 +0300
commitf6860e0e110a82fe61ce46de4fb5a05794e456ab (patch)
tree518ce233d41005903c292a9023a176f4a9c466db
parent86436fce2fe2364bbc9e705ddc92d7733fc8ed75 (diff)
downloadapk-tools-f6860e0e110a82fe61ce46de4fb5a05794e456ab.tar.bz2
apk-tools-f6860e0e110a82fe61ce46de4fb5a05794e456ab.tar.xz
libfetch: fix ssl context leak
from freebsd
-rw-r--r--libfetch/common.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libfetch/common.c b/libfetch/common.c
index 1fbd0d4..3538cc4 100644
--- a/libfetch/common.c
+++ b/libfetch/common.c
@@ -735,6 +735,20 @@ fetch_close(conn_t *conn)
{
int ret;
+#ifdef WITH_SSL
+ if (conn->ssl) {
+ SSL_shutdown(conn->ssl);
+ SSL_set_connect_state(conn->ssl);
+ SSL_free(conn->ssl);
+ }
+ if (conn->ssl_ctx) {
+ SSL_CTX_free(conn->ssl_ctx);
+ }
+ if (conn->ssl_cert) {
+ X509_free(conn->ssl_cert);
+ }
+#endif
+
ret = close(conn->sd);
if (conn->cache_url)
fetchFreeURL(conn->cache_url);