Skip to content

Commit 075b45a

Browse files
committed
undo: attempt to fix free(): invalid size
- rust-lang/rust#39625 - https://davidben.net/2024/01/15/empty-slices.html
1 parent 975a3b9 commit 075b45a

File tree

1 file changed

+5
-4
lines changed
  • taskchampion/lib/src

1 file changed

+5
-4
lines changed

taskchampion/lib/src/kv.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::traits::*;
22
use crate::types::*;
3-
use std::ptr::null_mut;
3+
use crate::util::vec_into_raw_parts;
44
use taskchampion::storage::TaskMap;
55

66
#[ffizz_header::item]
@@ -122,10 +122,11 @@ impl CList for TCKVList {
122122

123123
impl Default for TCKVList {
124124
fn default() -> Self {
125+
let (ptr, len, capacity) = vec_into_raw_parts(Vec::default());
125126
Self {
126-
len: libc::size_t::default(),
127-
_capacity: libc::size_t::default(),
128-
items: null_mut(),
127+
items: ptr,
128+
len,
129+
_capacity: capacity,
129130
}
130131
}
131132
}

0 commit comments

Comments
 (0)