Reset CUDA error when using driver API cuXXX functions keep returning the same error code

If a kernel launch fails (for example, due to attempts to address out-of-bounds GPU memory), CUDA_ERROR_LAUNCH_FAILED is returned from subsequent cuCtxSynchronize() call. When, however, I try to call any other cuXXX function after that (for example, cuMemFree(), cuCtxDestroy(), or cuModuleUnload()), they also return CUDA_ERROR_LAUNCH_FAILED (but the functions themselves seem to work correctly despite non-zero return code).

The same problem seems to exist with the CUDA_ERROR_OUT_OF_MEMORY error: subsequent cuXXX calls also return CUDA_ERROR_OUT_OF_MEMORY.

Is it really the case or I’m doing something wrong? Maybe I should call something to reset the last error code? When working with runtime API, I can use cudaGetLastError() for this purpose (didn’t check whether it helps however, since it would require to rewrite all my code which currently uses driver API), but I don’t see any similar function among driver API.

I use CUDA Toolkit 3.1, GTX 470, and 257.21 developer driver.