diff --git a/src/write.rs b/src/write.rs index ed332e59..7eaa8d27 100644 --- a/src/write.rs +++ b/src/write.rs @@ -260,6 +260,7 @@ impl FileOptions { Rc::get_mut(field).unwrap() } }; + vec.reserve_exact(data.len() + 4); vec.write_u16::(header_id)?; vec.write_u16::(data.len() as u16)?; vec.write_all(data)?;