[Beignet] [PATCH] Fix a bug for double free of enqueueNativeKernel.

Yang, Rong R rong.r.yang at intel.com
Mon Oct 10 13:07:53 UTC 2016


LGTM, pushed, thanks.

> -----Original Message-----
> From: Beignet [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of
> junyan.he at inbox.com
> Sent: Thursday, September 29, 2016 18:05
> To: beignet at lists.freedesktop.org
> Subject: [Beignet] [PATCH] Fix a bug for double free of
> enqueueNativeKernel.
> 
> From: Junyan He <junyan.he at intel.com>
> 
> Signed-off-by: Junyan He <junyan.he at intel.com>
> ---
>  src/cl_api_kernel.c | 3 +++
>  src/cl_enqueue.c    | 1 -
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/src/cl_api_kernel.c b/src/cl_api_kernel.c index ef494e6..1fd687b
> 100644
> --- a/src/cl_api_kernel.c
> +++ b/src/cl_api_kernel.c
> @@ -311,6 +311,9 @@ clEnqueueNativeKernel(cl_command_queue
> command_queue,
>      data->offset = (size_t)num_mem_objects;
>      data->const_ptr = new_args_mem_loc;
>      data->user_func = user_func;
> +    new_args = NULL;
> +    new_mem_list = NULL;
> +    new_args_mem_loc = NULL; // Event delete will free them.
> 
>      if (e_status == CL_COMPLETE) {
>        // Sync mode, no need to queue event.
> diff --git a/src/cl_enqueue.c b/src/cl_enqueue.c index ac29ebe..29cf593
> 100644
> --- a/src/cl_enqueue.c
> +++ b/src/cl_enqueue.c
> @@ -484,7 +484,6 @@ cl_enqueue_native_kernel(enqueue_data *data,
> cl_int status)
>      cl_mem_unmap_auto(mem_list[i]);
>    }
> 
> -  free(data->ptr);
>  error:
>    return err;
>  }
> --
> 2.7.4
> 
> 
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list