Added support for WINEPREFIX environment variable.
[wine/multimedia.git] / misc / xmalloc.c
blobeed0cc336ac69b7e719cb9ac1129b44738835883
1 /*
2 xmalloc - a safe malloc
4 Use this function instead of malloc whenever you don't intend to check
5 the return value yourself, for instance because you don't have a good
6 way to handle a zero return value.
8 Typically, Wine's own memory requests should be handled by this function,
9 while the clients should use malloc directly (and Wine should return an
10 error to the client if allocation fails).
12 Copyright 1995 by Morten Welinder.
16 #include <stdlib.h>
17 #include <string.h>
18 #include "xmalloc.h"
19 #include "debugtools.h"
21 void *xmalloc( size_t size )
23 void *res;
25 res = malloc (size ? size : 1);
26 if (res == NULL)
28 MESSAGE("Virtual memory exhausted.\n");
29 exit (1);
31 memset(res,0,size);
32 return res;