Explicitly reset the CUDA error after malloc failures so that errors don't get propagated later.