Removed the last xmalloc calls.

This commit is contained in:
Dimitrie O. Paun 2000-04-24 17:33:06 +00:00 committed by Alexandre Julliard
parent e1e75371d9
commit cb18dbf9ce
5 changed files with 16 additions and 63 deletions

View File

@ -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) {

View File

@ -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"

View File

@ -1,19 +0,0 @@
#ifndef __WINE_XMALLOC_H
#define __WINE_XMALLOC_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/types.h>
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 */

View File

@ -26,8 +26,7 @@ C_SRCS = \
tweak.c \
version.c \
w32scomb.c \
wsprintf.c \
xmalloc.c
wsprintf.c
GLUE = printdrv.c

View File

@ -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 <stdlib.h>
#include <string.h>
#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;
}