[SHELL32]

- remove invalid pointer from list in case of failure to add the icon to the image list

svn path=/trunk/; revision=57613
This commit is contained in:
Jérôme Gardou 2012-10-25 00:10:20 +00:00
parent bec3a1f913
commit 68f5fd309d

View file

@ -323,7 +323,7 @@ fail:
static INT SIC_IconAppend (LPCWSTR sSourceFile, INT dwSourceIndex, HICON hSmallIcon, HICON hBigIcon, DWORD dwFlags) static INT SIC_IconAppend (LPCWSTR sSourceFile, INT dwSourceIndex, HICON hSmallIcon, HICON hBigIcon, DWORD dwFlags)
{ {
LPSIC_ENTRY lpsice; LPSIC_ENTRY lpsice;
INT ret, index, index1; INT ret, index, index1, indexDPA;
WCHAR path[MAX_PATH]; WCHAR path[MAX_PATH];
TRACE("%s %i %p %p\n", debugstr_w(sSourceFile), dwSourceIndex, hSmallIcon ,hBigIcon); TRACE("%s %i %p %p\n", debugstr_w(sSourceFile), dwSourceIndex, hSmallIcon ,hBigIcon);
@ -338,8 +338,8 @@ static INT SIC_IconAppend (LPCWSTR sSourceFile, INT dwSourceIndex, HICON hSmallI
EnterCriticalSection(&SHELL32_SicCS); EnterCriticalSection(&SHELL32_SicCS);
index = DPA_InsertPtr(sic_hdpa, 0x7fff, lpsice); indexDPA = DPA_InsertPtr(sic_hdpa, 0x7fff, lpsice);
if ( INVALID_INDEX == index ) if ( -1 == indexDPA )
{ {
ret = INVALID_INDEX; ret = INVALID_INDEX;
goto leave; goto leave;
@ -370,6 +370,7 @@ static INT SIC_IconAppend (LPCWSTR sSourceFile, INT dwSourceIndex, HICON hSmallI
leave: leave:
if(ret == INVALID_INDEX) if(ret == INVALID_INDEX)
{ {
if(indexDPA != -1) DPA_DeletePtr(sic_hdpa, indexDPA);
HeapFree(GetProcessHeap(), 0, lpsice->sSourceFile); HeapFree(GetProcessHeap(), 0, lpsice->sSourceFile);
SHFree(lpsice); SHFree(lpsice);
} }