You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// SAFETY: ✔️ `ptr` belongs to `self` per [`thin::Realloc::realloc_uninit`]'s documented safety preconditions, and thus was allocated with CoTaskMem{Alloc,Realloc}
101
-
let alloc = unsafe{CoTaskMemRealloc(ptr.as_ptr().cast(), new_size.max(1))};
102
-
NonNull::new(alloc.cast()).ok_or(())
100
+
if new_size == 0{
101
+
let alloc = thin::Alloc::alloc_uninit(self, new_size)?;
102
+
unsafe{ thin::Free::free(self, ptr)};
103
+
Ok(alloc)
104
+
}else{
105
+
// SAFETY: ✔️ `ptr` belongs to `self` per [`thin::Realloc::realloc_uninit`]'s documented safety preconditions, and thus was allocated with CoTaskMem{Alloc,Realloc}
106
+
let alloc = unsafe{CoTaskMemRealloc(ptr.as_ptr().cast(), new_size)};
0 commit comments