Commit cb18dbf9 authored by Dimitrie O. Paun's avatar Dimitrie O. Paun Committed by Alexandre Julliard

Removed the last xmalloc calls.

parent e1e75371
......@@ -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) {
......
......@@ -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"
......
#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 */
......@@ -26,8 +26,7 @@ C_SRCS = \
tweak.c \
version.c \
w32scomb.c \
wsprintf.c \
xmalloc.c
wsprintf.c
GLUE = printdrv.c
......
/*
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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment