From 6850c810d32a11330c9b1dd4889b447fa8434c36 Mon Sep 17 00:00:00 2001 From: Geoffroy Couprie Date: Thu, 3 Dec 2015 12:26:55 +0100 Subject: Increment SSL_CTX's reference count in Ssl::get_ssl_context() Without this, whenever the returned SslContext is released, the refcount of the underlying SSL_CTX will decrease and it will be freed too soon --- openssl/src/ssl/mod.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'openssl/src/ssl') diff --git a/openssl/src/ssl/mod.rs b/openssl/src/ssl/mod.rs index b25e7d28..a2096f41 100644 --- a/openssl/src/ssl/mod.rs +++ b/openssl/src/ssl/mod.rs @@ -995,6 +995,7 @@ impl Ssl { /// obtain the context corresponding to the current connection pub fn get_ssl_context(&self) -> SslContext { let ssl_ctx = unsafe { ffi::SSL_get_SSL_CTX(self.ssl) }; + let count = unsafe { ffi_extras::SSL_CTX_increment_refcount(ssl_ctx) }; SslContext { ctx: ssl_ctx } } } -- cgit v1.2.3