Skip to content

Commit

Permalink
Fix bug in original code. Luckily the only current usages of MakeUniq…
Browse files Browse the repository at this point in the history
…uePtrFromOrtAllocator are allocating `void` and the incorrect value didn't impact the allocation size's correctness.
  • Loading branch information
skottmckay committed Dec 28, 2023
1 parent 5d0bce4 commit 41d7161
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/onnxruntime/core/framework/allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ class IAllocator {
alloc_size = CheckedCalcMemSizeForArray(count_or_bytes, size);
}

T* p = static_cast<T*>(ort_allocator->Alloc(ort_allocator, count_or_bytes));
T* p = static_cast<T*>(ort_allocator->Alloc(ort_allocator, alloc_size));
return IAllocatorUniquePtr<T>{p,
[ort_allocator](T* p) {
ort_allocator->Free(ort_allocator, p);
Expand Down

0 comments on commit 41d7161

Please sign in to comment.