Merge pull request #5459 from daira/fix-drop-warning

Avoid a warning by explicitly calling drop
This commit is contained in:
Kris Nuttycombe 2022-01-10 19:46:40 -07:00 committed by GitHub
commit ed93cf5aff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 1 deletions

1
Cargo.lock generated
View File

@ -815,6 +815,7 @@ dependencies = [
"zcash_note_encryption",
"zcash_primitives",
"zcash_proofs",
"zeroize",
]
[[package]]

View File

@ -49,6 +49,7 @@ zcash_note_encryption = "0.1"
zcash_primitives = "0.5"
zcash_proofs = "0.5"
ed25519-zebra = "3"
zeroize = "1.4.2"
# Metrics
hyper = { version = "=0.14.2", default-features = false, features = ["server", "tcp", "http1"] }

View File

@ -4,6 +4,7 @@ use std::{
ffi::{CStr, CString},
ptr, slice,
};
use zeroize::Zeroize;
use zcash_primitives::zip339;
@ -63,7 +64,9 @@ pub extern "C" fn zip339_free_phrase(phrase: *const c_char) {
if !phrase.is_null() {
unsafe {
// It is correct to cast away const here; the memory is not actually immutable.
CString::from_raw(phrase as *mut c_char);
CString::from_raw(phrase as *mut c_char)
.into_bytes()
.zeroize();
}
}
}