Fixed a cudaFree problem where variables were freed twice