[PATCH] advapi32: Return on failed allocation (Coverity) (try 2)
Signed-off-by: André Hentschel <nerv(a)dawncrow.de> --- dlls/advapi32/registry.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dlls/advapi32/registry.c b/dlls/advapi32/registry.c index 2d2c1be4dce..01ae114bee1 100644 --- a/dlls/advapi32/registry.c +++ b/dlls/advapi32/registry.c @@ -3260,9 +3260,11 @@ static LONG load_mui_string(const WCHAR *file_name, UINT res_id, WCHAR *buffer, return ERROR_FILE_NOT_FOUND; size = GetFullPathNameW(file_name, 0, NULL, NULL); - full_name = heap_alloc(size * sizeof(WCHAR)); if (!size) return GetLastError(); + full_name = heap_alloc(size * sizeof(WCHAR)); + if (!full_name) + return GetLastError(); GetFullPathNameW(file_name, size, full_name, NULL); EnterCriticalSection(®_mui_cs); -- 2.17.1
Am 25.06.19 um 00:45 schrieb Alistair Leslie-Hughes:
Hi André,
+ full_name = heap_alloc(size * sizeof(WCHAR)); + if (!full_name) + return GetLastError(); Returning GetLastError() doesn't make much sense here since heap_alloc doesn't set it. E_OUTOFMEMORY would be a better value.
Regards Alistair.
Thx for the hint!
participants (2)
-
Alistair Leslie-Hughes -
André Hentschel