shell32: check result of HeapAlloc()

hto at mail.cnt.ru hto at mail.cnt.ru
Sun May 13 03:33:00 CDT 2007


James Hawkins wrote:
> On 5/12/07, hto at mail.cnt.ru <hto at mail.cnt.ru> wrote:
>>
>> --- wine-0.9.37-orig/dlls/shell32/folders.c     2007-05-12 
>> 22:53:06.000000000 +0000
>> +++ wine-0.9.37/dlls/shell32/folders.c  2007-05-13 00:17:00.000000000 
>> +0000
>> @@ -81,11 +81,15 @@ IExtractIconW* IExtractIconW_Constructor
>>         TRACE("%p\n", pidl);
>>
>>         ei = HeapAlloc(GetProcessHeap(),0,sizeof(IExtractIconWImpl));
>> -       ei->ref=1;
>> -       ei->lpVtbl = &eivt;
>> -       ei->lpvtblPersistFile = &pfvt;
>> -       ei->lpvtblExtractIconA = &eiavt;
>> -       ei->pidl=ILClone(pidl);
>> +
>> +       if (ei)
>> +       {
>> +         ei->ref=1;
>> +         ei->lpVtbl = &eivt;
>> +         ei->lpvtblPersistFile = &pfvt;
>> +         ei->lpvtblExtractIconA = &eiavt;
>> +         ei->pidl=ILClone(pidl);
>> +       }
>>
> 
> If a HeapAlloc call fails, you need to return with the appropriate error.
> 

It is already done in ISF_ControlPanel_fnGetUIObjectOf(), 
IShellFolder_fnGetUIObjectOf(), ISF_Desktop_fnGetUIObjectOf(), 
ISF_MyComputer_fnGetUIObjectOf().

...
pObj = (LPUNKNOWN) IExtractIconW_Constructor(pidl);
...
if (SUCCEEDED(hr) && !pObj)
     hr = E_OUTOFMEMORY;
...
return hr;



More information about the wine-devel mailing list