Skip to content

Commit

Permalink
boring: Fix memory leak in Deriver
Browse files Browse the repository at this point in the history
  • Loading branch information
ravi-signal committed Jul 1, 2022
1 parent 74a453d commit db03da8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions boring/src/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit db03da8

Please sign in to comment.