No need to run onfailure case to free allocated memory
Remove checks for NULL before cudaFree and delete