mirror of
https://github.com/tokio-rs/bytes.git
synced 2026-08-16 00:00:15 +02:00
Fix bugs in BytesMut::reserve_inner (#544)
This commit is contained in:
+1
-1
@@ -646,7 +646,7 @@ impl BytesMut {
|
||||
self.cap = v.capacity();
|
||||
} else {
|
||||
// calculate offset
|
||||
let off = v.capacity() - self.cap;
|
||||
let off = (self.ptr.as_ptr() as usize) - (v.as_ptr() as usize);
|
||||
|
||||
// new_cap is calculated in terms of `BytesMut`, not the underlying
|
||||
// `Vec`, so it does not take the offset into account.
|
||||
|
||||
Reference in New Issue
Block a user