aboutsummaryrefslogtreecommitdiff
path: root/src/rust/tor_allocate
diff options
context:
space:
mode:
authorChelsea Holland Komlo <me@chelseakomlo.com>2017-10-22 00:07:16 -0400
committerNick Mathewson <nickm@torproject.org>2017-10-27 10:02:08 -0400
commit91bca5c31b9eefe4d07645f690f69914c89a5594 (patch)
tree919d0f8b657a1e7311395189cfd75ad0ce7d8794 /src/rust/tor_allocate
parent76bbdfbfa9eca46b53d3ec5a44deafce51d2875a (diff)
downloadtor-91bca5c31b9eefe4d07645f690f69914c89a5594.tar.gz
tor-91bca5c31b9eefe4d07645f690f69914c89a5594.zip
move to allocating c strings from rust
Diffstat (limited to 'src/rust/tor_allocate')
-rw-r--r--src/rust/tor_allocate/tor_allocate.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/rust/tor_allocate/tor_allocate.rs b/src/rust/tor_allocate/tor_allocate.rs
index de1d13942e..e2fc3ea36c 100644
--- a/src/rust/tor_allocate/tor_allocate.rs
+++ b/src/rust/tor_allocate/tor_allocate.rs
@@ -26,9 +26,9 @@ extern "C" fn tor_malloc_ ( size: usize) -> *mut c_void {
/// A `String` that should be freed by tor_free in C
///
pub fn allocate_and_copy_string(src: &String) -> *mut c_char {
- let bytes = s.as_bytes();
+ let bytes = src.as_bytes();
- let size = s.len();
+ let size = bytes.len();
let size_with_null_byte = size + 1;
let dest = unsafe { tor_malloc_(size_with_null_byte) as *mut u8 };