introduce safety and a particular EncryptHelper

This commit is contained in:
holger krekel
2019-09-23 10:40:55 +02:00
parent 3388b42f20
commit 5cbcb76039
6 changed files with 166 additions and 125 deletions

View File

@@ -78,8 +78,8 @@ pub fn append_ct_param(
value: &str,
) -> Result<(), Error> {
unsafe {
let name_c = CString::new(name).unwrap().as_ptr();
let value_c = CString::new(value).unwrap().as_ptr();
let name_c = name.strdup();
let value_c = value.strdup();
clist_append!(
(*content).ct_parameters,
@@ -88,6 +88,8 @@ pub fn append_ct_param(
value_c as *const u8 as *const libc::c_char as *mut libc::c_char
)
);
libc::free(name_c as *mut libc::c_void);
libc::free(value_c as *mut libc::c_void);
}
Ok(())
}