X-Git-Url: http://git.openwrt.org/?a=blobdiff_plain;f=ustream-openssl.c;h=b080081c172ffc14786ef61b8e5c1e197b4e3003;hb=HEAD;hp=3d576be1cf9397adf812bc03f1c87fa4096f9678;hpb=3c49e70c462249c174062e8181d191c859c5e41b;p=project%2Fustream-ssl.git diff --git a/ustream-openssl.c b/ustream-openssl.c index 3d576be..b080081 100644 --- a/ustream-openssl.c +++ b/ustream-openssl.c @@ -245,13 +245,18 @@ __hidden void __ustream_ssl_context_free(struct ustream_ssl_ctx *ctx) free(ctx); } -void __ustream_ssl_session_free(void *ssl) +__hidden void __ustream_ssl_session_free(struct ustream_ssl *us) { - BIO *bio = SSL_get_wbio(ssl); - struct bio_ctx *ctx = BIO_get_data(bio); + BIO *bio = SSL_get_wbio(us->ssl); + struct bio_ctx *ctx; - SSL_shutdown(ssl); - SSL_free(ssl); + SSL_shutdown(us->ssl); + SSL_free(us->ssl); + + if (!us->conn) + return; + + ctx = BIO_get_data(bio); if (ctx) { BIO_meth_free(ctx->meth); free(ctx);