When the buffer has CL_MEM_ALLOC_HOST_PTR, the runtime need to free the host_ptr at destructor. But if the buffer is a subbuffer, then its host ptr is not allocated by itself, we should not free it here. Otherwise, it may cause some weird errors such as: "corrupted double-linked list..".
Signed-off-by: Zhigang Gong <[email protected]> --- src/cl_mem.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cl_mem.c b/src/cl_mem.c index 36ef2ce..9e57df4 100644 --- a/src/cl_mem.c +++ b/src/cl_mem.c @@ -1124,7 +1124,9 @@ cl_mem_delete(cl_mem mem) cl_buffer_unreference(mem->bo); } - if (mem->is_userptr && (mem->flags & CL_MEM_ALLOC_HOST_PTR)) + if (mem->is_userptr && + (mem->flags & CL_MEM_ALLOC_HOST_PTR) && + (mem->type != CL_MEM_SUBBUFFER_TYPE)) cl_free(mem->host_ptr); cl_free(mem); -- 1.8.3.2 _______________________________________________ Beignet mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/beignet
