diff options
author | Zhigang Gong <zhigang.gong@intel.com> | 2015-02-06 17:48:15 +0800 |
---|---|---|
committer | Zhigang Gong <zhigang.gong@intel.com> | 2015-02-09 09:43:57 +0800 |
commit | a3520f04801d4f1b5b99ea788ab696a79afa3e40 (patch) | |
tree | 0f9716da440d962c7e97cb161dd6ec29534acddc | |
parent | 65187362d44bda5e2c6e059676c5a16b4aa70647 (diff) | |
download | beignet-a3520f04801d4f1b5b99ea788ab696a79afa3e40.tar.gz |
runtime: don't free the host_ptr for a subbuffer.
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 <zhigang.gong@intel.com>
Reviewed-by: "Guo, Yejun" <yejun.guo@intel.com>
-rw-r--r-- | src/cl_mem.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cl_mem.c b/src/cl_mem.c index 5243efec..d2e502d1 100644 --- a/src/cl_mem.c +++ b/src/cl_mem.c @@ -1127,7 +1127,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); |