Skip to content

Commit

Permalink
Improve bad alloc check based on feedback (#1499)
Browse files Browse the repository at this point in the history
  • Loading branch information
julianmi authored Apr 12, 2024
1 parent bc5d135 commit b42053f
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -424,11 +424,11 @@ struct __sycl_usm_alloc
operator()(::std::size_t __elements) const
{
const auto& __queue = __exec.queue();
auto __buf = static_cast<_T*>(
sycl::malloc(sizeof(_T) * __elements, __queue.get_device(), __queue.get_context(), __alloc_t));
if (!__buf)
throw std::bad_alloc();
return __buf;
if (auto __buf = static_cast<_T*>(
sycl::malloc(sizeof(_T) * __elements, __queue.get_device(), __queue.get_context(), __alloc_t)))
return __buf;

throw std::bad_alloc();
}
};

Expand Down

0 comments on commit b42053f

Please sign in to comment.