[PATCH] include: Add and use a global heap_strdupW() helper
Alexandre Julliard
julliard at winehq.org
Tue Feb 13 03:50:47 CST 2018
Michael Stefaniuc <mstefani at mykolab.com> writes:
>> The current usage is clean only because we are not checking for
>> allocation failure, but that's broken. If we add proper handling, then
>> the NULL checks will be needed anyway.
> I assumed you want less HeapAlloc failure handling and not more!
> Especially as in the strdup cases the current "return NULL" seems to
> be good enough in practice.
> I don't remember to have ever seen a patch that adds extra error
> handling for that case.
You could argue that strdup() should be treated as a nofail function,
but then you should remove the second null check and let it crash on the
memcpy, or use HEAP_GENERATE_EXCEPTIONS. I'd prefer to have an explicit
xstrdup() function for this though, and have the regular strdup()
require error handling.
--
Alexandre Julliard
julliard at winehq.org
More information about the wine-devel
mailing list