shell32: check result of HeapAlloc()

hto at mail.cnt.ru hto at mail.cnt.ru
Sat May 12 19:23:25 CDT 2007


-------------- next part --------------
--- 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);
+	}
 
 	pdump(pidl);
 
--- wine-0.9.37-orig/dlls/shell32/shellole.c	2007-05-13 00:09:56.000000000 +0000
+++ wine-0.9.37/dlls/shell32/shellole.c	2007-05-13 00:17:00.000000000 +0000
@@ -402,13 +402,17 @@ static IClassFactory * IDefClF_fnConstru
 	IDefClFImpl* lpclf;
 
 	lpclf = HeapAlloc(GetProcessHeap(),0,sizeof(IDefClFImpl));
-	lpclf->ref = 1;
-	lpclf->lpVtbl = &dclfvt;
-	lpclf->lpfnCI = lpfnCI;
-	lpclf->pcRefDll = pcRefDll;
 
-	if (pcRefDll) InterlockedIncrement(pcRefDll);
-	lpclf->riidInst = riidInst;
+	if (lpclf)
+	{
+	  lpclf->ref = 1;
+	  lpclf->lpVtbl = &dclfvt;
+	  lpclf->lpfnCI = lpfnCI;
+	  lpclf->pcRefDll = pcRefDll;
+
+	  if (pcRefDll) InterlockedIncrement(pcRefDll);
+	  lpclf->riidInst = riidInst;
+	}
 
 	TRACE("(%p)%s\n",lpclf, shdebugstr_guid(riidInst));
 	return (LPCLASSFACTORY)lpclf;
--- wine-0.9.37-orig/dlls/shell32/shlview.c	2007-05-13 00:11:00.000000000 +0000
+++ wine-0.9.37/dlls/shell32/shlview.c	2007-05-13 00:17:00.000000000 +0000
@@ -184,6 +184,7 @@ typedef void (CALLBACK *PFNSHGETSETTINGS
 IShellView * IShellView_Constructor( IShellFolder * pFolder)
 {	IShellViewImpl * sv;
 	sv=HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IShellViewImpl));
+	if (!sv) return NULL;
 	sv->ref=1;
 	sv->lpVtbl=&svvt;
 	sv->lpvtblOleCommandTarget=&ctvt;
--- wine-0.9.37-orig/dlls/shell32/shv_bg_cmenu.c	2007-05-13 00:10:22.000000000 +0000
+++ wine-0.9.37/dlls/shell32/shv_bg_cmenu.c	2007-05-13 00:17:00.000000000 +0000
@@ -60,11 +60,15 @@ IContextMenu2 *ISvBgCm_Constructor(IShel
 	BgCmImpl* cm;
 
 	cm = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(BgCmImpl));
-	cm->lpVtbl = &cmvt;
-	cm->ref = 1;
-	cm->pSFParent = pSFParent;
-	cm->bDesktop = bDesktop;
-	if(pSFParent) IShellFolder_AddRef(pSFParent);
+
+	if (cm)
+	{
+	  cm->lpVtbl = &cmvt;
+	  cm->ref = 1;
+	  cm->pSFParent = pSFParent;
+	  cm->bDesktop = bDesktop;
+	  if(pSFParent) IShellFolder_AddRef(pSFParent);
+	}
 
 	TRACE("(%p)->()\n",cm);
 	return (IContextMenu2*)cm;
--- wine-0.9.37-orig/dlls/shell32/shv_item_cmenu.c	2007-05-13 00:10:26.000000000 +0000
+++ wine-0.9.37/dlls/shell32/shv_item_cmenu.c	2007-05-13 00:17:00.000000000 +0000
@@ -83,6 +83,8 @@ IContextMenu2 *ISvItemCm_Constructor(LPS
 	UINT  u;
 
 	cm = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(ItemCmImpl));
+	if (!cm) return NULL;
+
 	cm->lpVtbl = &cmvt;
 	cm->ref = 1;
 	cm->pidl = ILClone(pidl);


More information about the wine-patches mailing list