shell32: Prevent user after free in error case (Coverity).

Otherwise when hr is not SUCCEEDED we use array and free it again.

Signed-off-by: Fabian Maurer <dark.shadow4@web.de>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Fabian Maurer 2022-04-26 21:03:19 +02:00 committed by Alexandre Julliard
parent 5a231b0bfc
commit d98646f915
1 changed files with 6 additions and 6 deletions

View File

@ -1452,15 +1452,15 @@ HRESULT WINAPI SHCreateShellItemArrayFromIDLists(UINT cidl,
if(SUCCEEDED(ret))
{
ret = create_shellitemarray(array, cidl, psia);
heap_free(array);
if(SUCCEEDED(ret))
return ret;
}
for(i = 0; i < cidl; i++)
if(array[i]) IShellItem_Release(array[i]);
if(FAILED(ret))
{
for(i = 0; i < cidl; i++)
if(array[i]) IShellItem_Release(array[i]);
*psia = NULL;
}
heap_free(array);
*psia = NULL;
return ret;
}