Commit c2c73d90 authored by Marian Triebe's avatar Marian Triebe

Fix possible memory leak

parent c23ac61e
...@@ -88,10 +88,9 @@ class command : public ref_counted { ...@@ -88,10 +88,9 @@ class command : public ref_counted {
0, sizeof(typename R::value_type) * m_result_size, 0, sizeof(typename R::value_type) * m_result_size,
m_result.data(), 1, &event_k, &event_r); m_result.data(), 1, &event_k, &event_r);
if (err != CL_SUCCESS) { if (err != CL_SUCCESS) {
this->deref(); // failed to enqueue command
throw std::runtime_error("clEnqueueReadBuffer: " + throw std::runtime_error("clEnqueueReadBuffer: " +
get_opencl_error(err)); get_opencl_error(err));
this->deref(); // failed to enqueue command
return;
} }
err = clSetEventCallback(event_r, CL_COMPLETE, err = clSetEventCallback(event_r, CL_COMPLETE,
[](cl_event, cl_int, void* data) { [](cl_event, cl_int, void* data) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment