Removed some HEAP_xalloc calls.

diff --git a/dlls/lzexpand/lzexpand_main.c b/dlls/lzexpand/lzexpand_main.c
index adedcfe..7e99234 100644
--- a/dlls/lzexpand/lzexpand_main.c
+++ b/dlls/lzexpand/lzexpand_main.c
@@ -178,16 +178,23 @@
         for (i = 0; i < MAX_LZSTATES; i++) if (!lzstates[i]) break;
         if (i == MAX_LZSTATES) return LZERROR_GLOBALLOC;
 	lzstates[i] = lzs = HeapAlloc( GetProcessHeap(), 0, sizeof(struct lzstate) );
-
+	if(lzs == NULL) return LZERROR_GLOBALLOC;
+	
 	memset(lzs,'\0',sizeof(*lzs));
 	lzs->realfd	= hfSrc;
 	lzs->lastchar	= head.lastchar;
 	lzs->reallength = head.reallength;
 
-	lzs->get	= HEAP_xalloc( GetProcessHeap(), 0, GETLEN );
+	lzs->get	= HeapAlloc( GetProcessHeap(), 0, GETLEN );
 	lzs->getlen	= 0;
 	lzs->getcur	= 0;
 
+	if(lzs->get == NULL) {
+		HeapFree(GetProcessHeap(), 0, lzs);
+		lzstates[i] = NULL;
+		return LZERROR_GLOBALLOC;
+	}
+	
 	/* Yes, preinitialize with spaces */
 	memset(lzs->table,' ',0x1000);
 	/* Yes, start 16 byte from the END of the table */
@@ -534,8 +541,9 @@
 static LPSTR LZEXPAND_MangleName( LPCSTR fn )
 {
     char *p;
-    char *mfn = (char *)HEAP_xalloc( GetProcessHeap(), 0,
-                                     strlen(fn) + 3 ); /* "._" and \0 */
+    char *mfn = (char *)HeapAlloc( GetProcessHeap(), 0,
+                                   strlen(fn) + 3 ); /* "._" and \0 */
+    if(mfn == NULL) return NULL;
     strcpy( mfn, fn );
     if (!(p = strrchr( mfn, '\\' ))) p = mfn;
     if ((p = strchr( p, '.' )))
diff --git a/files/dos_fs.c b/files/dos_fs.c
index b2fd0fa..e657585 100644
--- a/files/dos_fs.c
+++ b/files/dos_fs.c
@@ -992,7 +992,7 @@
     DWORD ret = 0;
 
     longpathA = HEAP_strdupWtoA( GetProcessHeap(), 0, longpath );
-    shortpathA = HEAP_xalloc ( GetProcessHeap(), 0, shortlen );
+    shortpathA = HeapAlloc ( GetProcessHeap(), 0, shortlen );
 
     ret = GetShortPathNameA ( longpathA, shortpathA, shortlen );
     lstrcpynAtoW ( shortpath, shortpathA, shortlen );
@@ -1953,7 +1953,7 @@
 DWORD WINAPI QueryDosDeviceW(LPCWSTR devname,LPWSTR target,DWORD bufsize)
 {
     LPSTR devnameA = devname?HEAP_strdupWtoA(GetProcessHeap(),0,devname):NULL;
-    LPSTR targetA = (LPSTR)HEAP_xalloc(GetProcessHeap(),0,bufsize);
+    LPSTR targetA = (LPSTR)HeapAlloc(GetProcessHeap(),0,bufsize);
     DWORD ret = QueryDosDeviceA(devnameA,targetA,bufsize);
 
     lstrcpynAtoW(target,targetA,bufsize);
diff --git a/files/profile.c b/files/profile.c
index f4fa3bb..7644413 100644
--- a/files/profile.c
+++ b/files/profile.c
@@ -202,7 +202,8 @@
     PROFILESECTION **next_section;
     PROFILEKEY *key, *prev_key, **next_key;
 
-    first_section = HEAP_xalloc( GetProcessHeap(), 0, sizeof(*section) );
+    first_section = HeapAlloc( GetProcessHeap(), 0, sizeof(*section) );
+    if(first_section == NULL) return NULL; 
     first_section->name = NULL;
     first_section->key  = NULL;
     first_section->next = NULL;
@@ -226,7 +227,8 @@
             {
                 *p2 = '\0';
                 p++;
-                section = HEAP_xalloc( GetProcessHeap(), 0, sizeof(*section) );
+                section = HeapAlloc( GetProcessHeap(), 0, sizeof(*section) );
+		if(section == NULL) break;
                 section->name = HEAP_strdupA( GetProcessHeap(), 0, p );
                 section->key  = NULL;
                 section->next = NULL;
@@ -253,8 +255,9 @@
         }
 
         if(*p || !prev_key || *prev_key->name)
-          {
-           key = HEAP_xalloc( GetProcessHeap(), 0, sizeof(*key) );
+        {
+           key = HeapAlloc( GetProcessHeap(), 0, sizeof(*key) );
+	   if(key == NULL) break;
            key->name  = HEAP_strdupA( GetProcessHeap(), 0, p );
            key->value = p2 ? HEAP_strdupA( GetProcessHeap(), 0, p2 ) : NULL;
            key->next  = NULL;
@@ -263,7 +266,7 @@
            prev_key   = key;
 
            TRACE("New key: name='%s', value='%s'\n",key->name,key->value?key->value:"(none)");
-          }
+        }
     }
     return first_section;
 }
@@ -426,7 +429,8 @@
                 key = &(*key)->next;
             }
             if (!create) return NULL;
-            *key = HEAP_xalloc( GetProcessHeap(), 0, sizeof(PROFILEKEY) );
+            *key = HeapAlloc( GetProcessHeap(), 0, sizeof(PROFILEKEY) );
+	    if(*key == NULL) return NULL;
             (*key)->name  = HEAP_strdupA( GetProcessHeap(), 0, key_name );
             (*key)->value = NULL;
             (*key)->next  = NULL;
@@ -435,10 +439,16 @@
         section = &(*section)->next;
     }
     if (!create) return NULL;
-    *section = HEAP_xalloc( GetProcessHeap(), 0, sizeof(PROFILESECTION) );
+    *section = HeapAlloc( GetProcessHeap(), 0, sizeof(PROFILESECTION) );
+    if(*section == NULL) return NULL;
     (*section)->name = HEAP_strdupA( GetProcessHeap(), 0, section_name );
     (*section)->next = NULL;
-    (*section)->key  = HEAP_xalloc( GetProcessHeap(), 0, sizeof(PROFILEKEY) );
+    (*section)->key  = HeapAlloc( GetProcessHeap(), 0, sizeof(PROFILEKEY) );
+    if((*section)->key  == NULL)
+    {
+	    HeapFree(GetProcessHeap(), 0, *section);
+	    return NULL;
+    }
     (*section)->key->name  = HEAP_strdupA( GetProcessHeap(), 0, key_name );
     (*section)->key->value = NULL;
     (*section)->key->next  = NULL;
@@ -535,7 +545,8 @@
     if(!CurProfile)
        for(i=0;i<N_CACHED_PROFILES;i++)
          {
-          MRUProfile[i]=HEAP_xalloc( GetProcessHeap(), 0, sizeof(PROFILE) );
+          MRUProfile[i]=HeapAlloc( GetProcessHeap(), 0, sizeof(PROFILE) );
+	  if(MRUProfile[i] == NULL) break;
           MRUProfile[i]->changed=FALSE;
           MRUProfile[i]->section=NULL;
           MRUProfile[i]->dos_name=NULL;
diff --git a/graphics/painting.c b/graphics/painting.c
index 61404ad..3413c58 100644
--- a/graphics/painting.c
+++ b/graphics/painting.c
@@ -712,11 +712,15 @@
     nrpts=0;
     for (i=polygons;i--;)
     	nrpts+=counts[i];
-    pt32 = (LPPOINT)HEAP_xalloc( GetProcessHeap(), 0, sizeof(POINT)*nrpts);
+    pt32 = (LPPOINT)HeapAlloc( GetProcessHeap(), 0, sizeof(POINT)*nrpts);
+    if(pt32 == NULL) return FALSE;
     for (i=nrpts;i--;)
     	CONV_POINT16TO32(&(pt[i]),&(pt32[i]));
-    counts32 = (LPINT)HEAP_xalloc( GetProcessHeap(), 0,
-                                     polygons*sizeof(INT) );
+    counts32 = (LPINT)HeapAlloc( GetProcessHeap(), 0, polygons*sizeof(INT) );
+    if(counts32 == NULL) {
+	HeapFree( GetProcessHeap(), 0, pt32 );
+	return FALSE;
+    }
     for (i=polygons;i--;) counts32[i]=counts[i];
    
     ret = PolyPolygon(hdc,pt32,counts32,polygons);
diff --git a/windows/x11drv/event.c b/windows/x11drv/event.c
index bcb8fd2..6ab4334 100644
--- a/windows/x11drv/event.c
+++ b/windows/x11drv/event.c
@@ -984,7 +984,8 @@
        cTargets++;
     
     /* Allocate temp buffer */
-    targets = (Atom*)HEAP_xalloc( GetProcessHeap(), 0, cTargets * sizeof(Atom));
+    targets = (Atom*)HeapAlloc( GetProcessHeap(), 0, cTargets * sizeof(Atom));
+    if(targets == NULL) return None;
 
     /* Create TARGETS property list (First item in list is TARGETS itself) */
 
@@ -1080,7 +1081,8 @@
     size = GlobalSize16(hText);
     /* remove carriage returns */
     
-    lpstr = (char*)HEAP_xalloc( GetProcessHeap(), 0, size-- );
+    lpstr = (char*)HeapAlloc( GetProcessHeap(), 0, size-- );
+    if(lpstr == NULL) return None;
     for(i=0,j=0; i < size && text[i]; i++ )
     {
         if( text[i] == '\r' &&