Fix cl_mem memory leaks