Dmitry Timoshkov (@dmitry) commented about dlls/taskschd/regtask.c:
- }
- if (!task_names)
- {
VariantClear(&converted_index);
return E_INVALIDARG;
- }
- hr = TaskDefinition_create(&definition);
- if (FAILED(hr))
goto cleanup;
- hr = RegisteredTask_create(collection->path, task_names[0], definition, TASK_VALIDATE_ONLY, TASK_LOGON_INTERACTIVE_TOKEN, regtask, FALSE);
- if (FAILED(hr))
goto cleanup;
- hr = S_OK;
+cleanup:
It should be possible to avoid using 'goto' and forcing 'hr' to a specific value.