aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--openssl/src/x509/mod.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/openssl/src/x509/mod.rs b/openssl/src/x509/mod.rs
index 6bb58dbd..6023b5a9 100644
--- a/openssl/src/x509/mod.rs
+++ b/openssl/src/x509/mod.rs
@@ -121,13 +121,15 @@ impl X509StoreContextRef {
unsafe {
ffi::init();
let context = try!(cvt_p(ffi::X509_STORE_CTX_new()).map(|p| X509StoreContext(p)));
- try!(cvt(ffi::X509_STORE_CTX_init(context.as_ptr(), trust.as_ptr(), cert.as_ptr(), cert_chain.as_ptr()))
- .map(|_| ()));
+ let init_result = cvt(ffi::X509_STORE_CTX_init(context.as_ptr(), trust.as_ptr(), cert.as_ptr(), cert_chain.as_ptr()))
+ .map(|_| ());
mem::forget(trust);
mem::forget(cert);
mem::forget(cert_chain);
+ try!(init_result);
+
// verify_cert returns an error `<= 0` if there was a validation error
try!(cvt(ffi::X509_verify_cert(context.as_ptr())).map(|_| ()));