Skip to content

Commit 0aa1728

Browse files
committed
Merge remote-tracking branch 'openssl/master'
2 parents 1ec9a15 + b46d5ec commit 0aa1728

6 files changed

Lines changed: 14 additions & 6 deletions

File tree

openssl/src/dsa.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ impl<T> ToOwned for DsaRef<T> {
7272

7373
fn to_owned(&self) -> Dsa<T> {
7474
unsafe {
75-
ffi::DSA_up_ref(self.as_ptr());
75+
let r = ffi::DSA_up_ref(self.as_ptr());
76+
assert!(r == 1);
7677
Dsa::from_ptr(self.as_ptr())
7778
}
7879
}

openssl/src/macros.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ macro_rules! generic_foreign_type_and_impl_send_sync {
231231
fn clone(&self) -> $owned<T> {
232232
unsafe {
233233
let handle: *mut $ctype = $clone(self.0);
234+
assert!(!handle.is_null());
234235
::foreign_types::ForeignType::from_ptr(handle)
235236
}
236237
}
@@ -243,6 +244,7 @@ macro_rules! generic_foreign_type_and_impl_send_sync {
243244
unsafe {
244245
let handle: *mut $ctype =
245246
$clone(::foreign_types::ForeignTypeRef::as_ptr(self));
247+
assert!(!handle.is_null());
246248
$crate::ForeignType::from_ptr(handle)
247249
}
248250
}

openssl/src/pkey.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,8 @@ impl<T> ToOwned for PKeyRef<T> {
189189

190190
fn to_owned(&self) -> PKey<T> {
191191
unsafe {
192-
EVP_PKEY_up_ref(self.as_ptr());
192+
let r = EVP_PKEY_up_ref(self.as_ptr());
193+
assert!(r == 1);
193194
PKey::from_ptr(self.as_ptr())
194195
}
195196
}

openssl/src/rsa.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ impl<T> ToOwned for RsaRef<T> {
8484

8585
fn to_owned(&self) -> Rsa<T> {
8686
unsafe {
87-
ffi::RSA_up_ref(self.as_ptr());
87+
let r = ffi::RSA_up_ref(self.as_ptr());
88+
assert!(r == 1);
8889
Rsa::from_ptr(self.as_ptr())
8990
}
9091
}

openssl/src/ssl/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2282,7 +2282,8 @@ impl ToOwned for SslContextRef {
22822282

22832283
fn to_owned(&self) -> Self::Owned {
22842284
unsafe {
2285-
SSL_CTX_up_ref(self.as_ptr());
2285+
let r = SSL_CTX_up_ref(self.as_ptr());
2286+
assert!(r == 1);
22862287
SslContext::from_ptr(self.as_ptr())
22872288
}
22882289
}
@@ -2669,7 +2670,8 @@ impl ToOwned for SslSessionRef {
26692670

26702671
fn to_owned(&self) -> SslSession {
26712672
unsafe {
2672-
SSL_SESSION_up_ref(self.as_ptr());
2673+
let r = SSL_SESSION_up_ref(self.as_ptr());
2674+
assert!(r == 1);
26732675
SslSession(self.as_ptr())
26742676
}
26752677
}

openssl/src/x509/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,8 @@ impl ToOwned for X509Ref {
825825

826826
fn to_owned(&self) -> X509 {
827827
unsafe {
828-
X509_up_ref(self.as_ptr());
828+
let r = X509_up_ref(self.as_ptr());
829+
assert!(r == 1);
829830
X509::from_ptr(self.as_ptr())
830831
}
831832
}

0 commit comments

Comments
 (0)