We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f54c9b2 commit 01a5517Copy full SHA for 01a5517
glib/src/collections/strv.rs
@@ -446,8 +446,10 @@ impl StrV {
446
if len == 0 {
447
StrV::default()
448
} else {
449
+ // Allocate space for len + 1 pointers, one pointer for each string and a trailing
450
+ // null pointer.
451
let new_ptr =
- ffi::g_malloc(mem::size_of::<*mut c_char>() * len + 1) as *mut *mut c_char;
452
+ ffi::g_malloc(mem::size_of::<*mut c_char>() * (len + 1)) as *mut *mut c_char;
453
454
// Need to clone every item because we don't own it here
455
for i in 0..len {
0 commit comments