fix clEnqueueMarkerWithWaitList bug when input event is null.
authorLuo <xionghu.luo@intel.com>
Tue, 17 Jun 2014 02:59:05 +0000 (10:59 +0800)
committerZhigang Gong <zhigang.gong@intel.com>
Tue, 17 Jun 2014 09:15:16 +0000 (17:15 +0800)
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
src/cl_api.c
src/cl_event.c

index 73447c4..327f02b 100644 (file)
@@ -2973,10 +2973,7 @@ clEnqueueMarkerWithWaitList(cl_command_queue command_queue,
 {
   cl_int err = CL_SUCCESS;
   CHECK_QUEUE(command_queue);
-  if(event == NULL) {
-    err = CL_INVALID_VALUE;
-    goto error;
-  }
+
   TRY(cl_event_check_waitlist, num_events_in_wait_list, event_wait_list, event, command_queue->ctx);
 
   cl_event_marker_with_wait_list(command_queue, num_events_in_wait_list, event_wait_list, event);
index c93d245..76d6760 100644 (file)
@@ -476,11 +476,16 @@ cl_int cl_event_marker_with_wait_list(cl_command_queue queue,
                 cl_event* event)
 {
   enqueue_data data = { 0 };
+  cl_event e;
 
-  *event = cl_event_new(queue->ctx, queue, CL_COMMAND_MARKER, CL_TRUE);
-  if(event == NULL)
+  e = cl_event_new(queue->ctx, queue, CL_COMMAND_MARKER, CL_TRUE);
+  if(e == NULL)
     return CL_OUT_OF_HOST_MEMORY;
 
+  if(event != NULL ){
+    *event = e;
+  }
+
 //enqueues a marker command which waits for either a list of events to complete, or if the list is
 //empty it waits for all commands previously enqueued in command_queue to complete before it  completes.
   if(num_events_in_wait_list > 0){
@@ -499,7 +504,7 @@ cl_int cl_event_marker_with_wait_list(cl_command_queue queue,
     cl_gpgpu_event_update_status(queue->last_event->gpgpu_event, 1);
   }
 
-  cl_event_set_status(*event, CL_COMPLETE);
+  cl_event_set_status(e, CL_COMPLETE);
   return CL_SUCCESS;
 }