fixing the memory leak
Standardizing OpenCL error checking