diff options
| author | Benjamin Fry <[email protected]> | 2017-02-16 08:14:03 -0800 |
|---|---|---|
| committer | Benjamin Fry <[email protected]> | 2017-02-16 08:14:03 -0800 |
| commit | b2e150bf3c4d5949f339d1e9b7dee4f94bd06cdd (patch) | |
| tree | 3ff293c690b0884f3dba1e935aae3c26201b3860 | |
| parent | fix versions for sys as well (diff) | |
| download | rust-openssl-b2e150bf3c4d5949f339d1e9b7dee4f94bd06cdd.tar.xz rust-openssl-b2e150bf3c4d5949f339d1e9b7dee4f94bd06cdd.zip | |
review fixes: reorder forget()
| -rw-r--r-- | openssl/src/ssl/mod.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/openssl/src/ssl/mod.rs b/openssl/src/ssl/mod.rs index 899ff1a6..ceb0d070 100644 --- a/openssl/src/ssl/mod.rs +++ b/openssl/src/ssl/mod.rs @@ -654,14 +654,18 @@ impl SslContextBuilder { } } - /// Sets a custom X509Store for verifying peer certificates + /// Sets a custom X509Store for verifying peer certificates. + /// + /// Requires the `v102` feature and OpenSSL 1.0.2, or the `v110` feature and OpenSSL 1.1.0. #[cfg(any(all(feature = "v102", ossl102), all(feature = "v110", ossl110)))] pub fn set_verify_cert_store(&mut self, cert_store: X509Store) -> Result<(), ErrorStack> { unsafe { // set0 will free, set1 increments, and then requires a free let ptr = cert_store.as_ptr(); + let result = cvt(ffi::SSL_CTX_set0_verify_cert_store(self.as_ptr(), ptr) as c_int).map(|_|()); + mem::forget(cert_store); - cvt(ffi::SSL_CTX_set0_verify_cert_store(self.as_ptr(), ptr) as c_int).map(|_|()) + result } } |