boring: Fix memory leak in `Deriver`

This commit is contained in:
Ravi Khadiwala 2022-06-30 20:15:49 -05:00
parent 74a453d8b0
commit db03da82fd
1 changed files with 8 additions and 0 deletions

View File

@ -14,6 +14,14 @@ pub struct Deriver<'a>(*mut ffi::EVP_PKEY_CTX, PhantomData<&'a ()>);
unsafe impl<'a> Sync for Deriver<'a> {}
unsafe impl<'a> Send for Deriver<'a> {}
impl<'a> Drop for Deriver<'a> {
fn drop(&mut self) {
unsafe {
ffi::EVP_PKEY_CTX_free(self.0);
}
}
}
#[allow(clippy::len_without_is_empty)]
impl<'a> Deriver<'a> {
/// Creates a new `Deriver` using the provided private key.