Skip to content

Commit

Permalink
Merge pull request #79 from signalapp/deriver-leak
Browse files Browse the repository at this point in the history
boring: Fix memory leak in `Deriver`
  • Loading branch information
inikulin authored May 11, 2023
2 parents 0dd85d1 + db03da8 commit ec52371
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 ec52371

Please sign in to comment.