From 1fa1950ab1d185d5d310e413a779563b03585d5b Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Tue, 7 Apr 2015 17:55:49 +0200 Subject: [PATCH] Allocate only as much as necessary. --- ports/cef/wrappers.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/cef/wrappers.rs b/ports/cef/wrappers.rs index d8929352c84..9964eac6728 100644 --- a/ports/cef/wrappers.rs +++ b/ports/cef/wrappers.rs @@ -246,7 +246,7 @@ impl<'a> CefWrap for String { let boxed_string; unsafe { let buffer = libc::malloc((mem::size_of::() as u64) * - ((utf16_chars.len() + 1) as u64 + 1)) as *mut u16; + ((utf16_chars.len() + 1) as u64)) as *mut u16; for (i, ch) in utf16_chars.iter().enumerate() { *buffer.offset(i as int) = *ch }