From 41d7161430766df74300ac5531186929b1c682ef Mon Sep 17 00:00:00 2001 From: Scott McKay Date: Thu, 28 Dec 2023 17:09:40 +1000 Subject: [PATCH] Fix bug in original code. Luckily the only current usages of MakeUniquePtrFromOrtAllocator are allocating `void` and the incorrect value didn't impact the allocation size's correctness. --- include/onnxruntime/core/framework/allocator.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/onnxruntime/core/framework/allocator.h b/include/onnxruntime/core/framework/allocator.h index 1aa7bcb7dd501..67ae6ece6327f 100644 --- a/include/onnxruntime/core/framework/allocator.h +++ b/include/onnxruntime/core/framework/allocator.h @@ -199,7 +199,7 @@ class IAllocator { alloc_size = CheckedCalcMemSizeForArray(count_or_bytes, size); } - T* p = static_cast(ort_allocator->Alloc(ort_allocator, count_or_bytes)); + T* p = static_cast(ort_allocator->Alloc(ort_allocator, alloc_size)); return IAllocatorUniquePtr{p, [ort_allocator](T* p) { ort_allocator->Free(ort_allocator, p);