mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-18 16:56:16 +00:00
dbghelp: Handle memory allocation failure in image_locate_build_id_target (cppcheck).
This commit is contained in:
parent
3e5a956563
commit
7a441eafb4
|
@ -660,6 +660,7 @@ static BOOL image_locate_build_id_target(struct image_file_map* fmap, const BYTE
|
|||
|
||||
p = malloc(sizeof(L"/usr/lib/debug/.build-id/") +
|
||||
(idlen * 2 + 1) * sizeof(WCHAR) + sizeof(L".debug"));
|
||||
if (!p) goto fail;
|
||||
wcscpy(p, L"/usr/lib/debug/.build-id/");
|
||||
z = p + wcslen(p);
|
||||
if (idlen)
|
||||
|
@ -684,9 +685,11 @@ static BOOL image_locate_build_id_target(struct image_file_map* fmap, const BYTE
|
|||
sz = GetEnvironmentVariableW(L"WINEHOMEDIR", NULL, 0);
|
||||
if (sz)
|
||||
{
|
||||
p = realloc(p, sz * sizeof(WCHAR) +
|
||||
z = realloc(p, sz * sizeof(WCHAR) +
|
||||
sizeof(L"\\.cache\\debuginfod_client\\") +
|
||||
idlen * 2 * sizeof(WCHAR) + sizeof(L"\\debuginfo") + 500);
|
||||
if (!z) goto fail;
|
||||
p = z;
|
||||
GetEnvironmentVariableW(L"WINEHOMEDIR", p, sz);
|
||||
z = p + sz - 1;
|
||||
wcscpy(z, L"\\.cache\\debuginfod_client\\");
|
||||
|
@ -703,6 +706,7 @@ static BOOL image_locate_build_id_target(struct image_file_map* fmap, const BYTE
|
|||
}
|
||||
|
||||
TRACE("not found\n");
|
||||
fail:
|
||||
free(p);
|
||||
HeapFree(GetProcessHeap(), 0, fmap_link);
|
||||
return FALSE;
|
||||
|
|
Loading…
Reference in a new issue