fix leak on win32 when error is being reset