diff --git a/dlls/version/install.c b/dlls/version/install.c index 41dc44a1503..107de361977 100644 --- a/dlls/version/install.c +++ b/dlls/version/install.c @@ -15,7 +15,6 @@ #include "winerror.h" #include "heap.h" #include "lzexpand.h" -#include "xmalloc.h" #include "debugtools.h" DEFAULT_DEBUG_CHANNEL(ver); @@ -355,17 +354,25 @@ _fetch_versioninfo(LPSTR fn,VS_FIXEDFILEINFO **vffi) { DWORD ret; alloclen = 1000; - buf= xmalloc(alloclen); + buf=HeapAlloc(GetProcessHeap(), 0, alloclen); + if(buf == NULL) { + WARN("Memory exausted while fetching version info!"); + return NULL; + } while (1) { ret = GetFileVersionInfoA(fn,0,alloclen,buf); if (!ret) { - free(buf); - return 0; + HeapFree(GetProcessHeap(), 0, buf); + return NULL; } if (alloclen<*(WORD*)buf) { - free(buf); alloclen = *(WORD*)buf; - buf = xmalloc(alloclen); + HeapFree(GetProcessHeap(), 0, buf); + buf = HeapAlloc(GetProcessHeap(), 0, alloclen); + if(buf == NULL) { + WARN("Memory exausted while fetching version info!"); + return NULL; + } } else { *vffi = (VS_FIXEDFILEINFO*)(buf+0x14); if ((*vffi)->dwSignature == 0x004f0049) /* hack to detect unicode */ @@ -510,10 +517,10 @@ DWORD WINAPI VerInstallFileA( * generiert DIFFLANG|MISMATCH */ } - free(buf2); + HeapFree(GetProcessHeap(), 0, buf2); } else xret=VIF_MISMATCH|VIF_SRCOLD; - free(buf1); + HeapFree(GetProcessHeap(), 0, buf1); } } if (xret) { diff --git a/graphics/x11drv/bitmap.c b/graphics/x11drv/bitmap.c index 90e2ada0f09..65468bbd9b7 100644 --- a/graphics/x11drv/bitmap.c +++ b/graphics/x11drv/bitmap.c @@ -20,7 +20,6 @@ #include "bitmap.h" #include "heap.h" #include "debugtools.h" -#include "xmalloc.h" #include "local.h" #include "x11drv.h" #include "wingdi.h" diff --git a/include/xmalloc.h b/include/xmalloc.h deleted file mode 100644 index cc44c33974a..00000000000 --- a/include/xmalloc.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef __WINE_XMALLOC_H -#define __WINE_XMALLOC_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -void *xmalloc( size_t size ); -void *xcalloc( size_t size ); -void *xrealloc( void *ptr, size_t size ); -char *xstrdup( const char *str ); - -#ifdef __cplusplus -} -#endif - -#endif /* __WINE_XMALLOC_H */ diff --git a/misc/Makefile.in b/misc/Makefile.in index 30cf95e2184..c53b14b4c6b 100644 --- a/misc/Makefile.in +++ b/misc/Makefile.in @@ -26,8 +26,7 @@ C_SRCS = \ tweak.c \ version.c \ w32scomb.c \ - wsprintf.c \ - xmalloc.c + wsprintf.c GLUE = printdrv.c diff --git a/misc/xmalloc.c b/misc/xmalloc.c deleted file mode 100644 index eed0cc336ac..00000000000 --- a/misc/xmalloc.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - xmalloc - a safe malloc - - Use this function instead of malloc whenever you don't intend to check - the return value yourself, for instance because you don't have a good - way to handle a zero return value. - - Typically, Wine's own memory requests should be handled by this function, - while the clients should use malloc directly (and Wine should return an - error to the client if allocation fails). - - Copyright 1995 by Morten Welinder. - -*/ - -#include -#include -#include "xmalloc.h" -#include "debugtools.h" - -void *xmalloc( size_t size ) -{ - void *res; - - res = malloc (size ? size : 1); - if (res == NULL) - { - MESSAGE("Virtual memory exhausted.\n"); - exit (1); - } - memset(res,0,size); - return res; -}