Fix throwing from SVMAllocator with exceptions disabled (#255)
diff --git a/include/CL/opencl.hpp b/include/CL/opencl.hpp index cb6e688..2b926ac 100644 --- a/include/CL/opencl.hpp +++ b/include/CL/opencl.hpp
@@ -4105,8 +4105,12 @@ if (map && !(SVMTrait::getSVMMemFlags() & CL_MEM_SVM_FINE_GRAIN_BUFFER)) { cl_int err = enqueueMapSVM(retValue, CL_TRUE, CL_MAP_READ | CL_MAP_WRITE, size*sizeof(T)); if (err != CL_SUCCESS) { + clSVMFree(context_(), retValue); + retValue = nullptr; +#if defined(CL_HPP_ENABLE_EXCEPTIONS) std::bad_alloc excep; throw excep; +#endif } }