mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Allocate only as much as necessary.
This commit is contained in:
parent
cba3b6806e
commit
1fa1950ab1
1 changed files with 1 additions and 1 deletions
|
@ -246,7 +246,7 @@ impl<'a> CefWrap<cef_string_userfree_t> for String {
|
||||||
let boxed_string;
|
let boxed_string;
|
||||||
unsafe {
|
unsafe {
|
||||||
let buffer = libc::malloc((mem::size_of::<c_ushort>() as u64) *
|
let buffer = libc::malloc((mem::size_of::<c_ushort>() 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() {
|
for (i, ch) in utf16_chars.iter().enumerate() {
|
||||||
*buffer.offset(i as int) = *ch
|
*buffer.offset(i as int) = *ch
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue