[PATCH 2/5] regedit: Use 'return' statements in delete_registry_key() to allow for memory clean-up

Alexandre Julliard julliard at winehq.org
Tue Jul 11 02:00:22 CDT 2017


Hugh McMaster <hugh.mcmaster at outlook.com> writes:

> On Tuesday, 11 July 2017 4:36 AM, Alexandre Julliard wrote:
>> Hugh McMaster <hugh.mcmaster at outlook.com> writes:
>>> @@ -1593,11 +1593,11 @@ void delete_registry_key(WCHAR *reg_key_name)
>>>  
>>>      if (!(key_class = parse_key_name(reg_key_name, &key_name))) {
>>>          output_message(STRING_INCORRECT_REG_CLASS, reg_key_name);
>>> -        exit(1);
>>> +        return;
>>>      }
>>>      if (!*key_name) {
>>>          output_message(STRING_DELETE_REG_CLASS_FAILED, reg_key_name);
>>> -        exit(1);
>>> +        return;
>>
>> If the process is going to exit anyway, freeing memory is a waste of time.
>
> At the very least, all uses of exit(1) should be exit(0), as the Windows
> version always terminates with an exit code of zero. But I don't how much
> this matters in practice.
>
> Do you want me to change them? I think there are around seven or eight 
> exit() calls in the code.

I'd suggest some kind of fatal_error() helper that prints an error and
exits.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list