Fixed potential memory leak when cl_mem creation was failed.