diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-06-21 08:38:21 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-06-21 08:38:21 -0400 |
commit | 72a5ae8c667fac09a639c46a145c9612424ef301 (patch) | |
tree | 180cb720148736fde8f70260418b1292402cff7f /src/rust/external | |
parent | 683776bfab21ec48d967d8589412f81c6b39afe6 (diff) | |
parent | 73bc863822bc58adaafc4017c25acaff0ecb43c1 (diff) | |
download | tor-72a5ae8c667fac09a639c46a145c9612424ef301.tar.gz tor-72a5ae8c667fac09a639c46a145c9612424ef301.zip |
Merge branch 'maint-0.3.4'
Diffstat (limited to 'src/rust/external')
-rw-r--r-- | src/rust/external/crypto_digest.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/rust/external/crypto_digest.rs b/src/rust/external/crypto_digest.rs index 4eae1550a2..3e8801f203 100644 --- a/src/rust/external/crypto_digest.rs +++ b/src/rust/external/crypto_digest.rs @@ -140,7 +140,7 @@ extern "C" { fn crypto_digest_new() -> *mut crypto_digest_t; fn crypto_digest256_new(algorithm: digest_algorithm_t) -> *mut crypto_digest_t; fn crypto_digest512_new(algorithm: digest_algorithm_t) -> *mut crypto_digest_t; - fn crypto_digest_free(digest: *mut crypto_digest_t); + fn crypto_digest_free_(digest: *mut crypto_digest_t); fn crypto_digest_add_bytes(digest: *mut crypto_digest_t, data: *const c_char, len: size_t); fn crypto_digest_get_digest(digest: *mut crypto_digest_t, out: *mut c_char, out_len: size_t); fn crypto_digest_dup(digest: *const crypto_digest_t) -> *mut crypto_digest_t; @@ -292,6 +292,14 @@ impl CryptoDigest { } } +impl Drop for CryptoDigest { + fn drop(&mut self) { + unsafe { + crypto_digest_free_(self.0 as *mut crypto_digest_t); + } + } +} + /// Get the 256-bit digest output of a `crypto_digest_t`. /// /// # Inputs |