mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-17 22:50:51 +00:00
- audit malloc usage. now everything checks the return value :)
This commit is contained in:
parent
133ce647fb
commit
3bba5398ba
32 changed files with 109 additions and 29 deletions
|
@ -80,6 +80,10 @@ SNDDMA_Init (void)
|
|||
shm->samples = 16384; // mono samples in buffer
|
||||
shm->speed = 44100;
|
||||
shm->buffer = malloc (shm->samples * shm->channels * shm->samplebits / 8);
|
||||
if (!shm->buffer) {
|
||||
Sys_Printf ("SNDDMA_Init: memory allocation failure\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
Sys_Printf ("%5d stereo\n", shm->channels - 1);
|
||||
Sys_Printf ("%5d samples\n", shm->samples);
|
||||
|
|
|
@ -72,6 +72,8 @@ Mod_Fullbright (byte * skin, int width, int height, char *name)
|
|||
|
||||
// ptexels = Hunk_Alloc(s);
|
||||
ptexels = malloc (pixels);
|
||||
if (!ptexels)
|
||||
Sys_Error ("Mod_Fullbright: Memory Allocation Failure\n");
|
||||
if (Mod_CalcFullbright (skin, ptexels, pixels)) {
|
||||
Sys_DPrintf ("FB Model ID: '%s'\n", name);
|
||||
texnum = GL_LoadTexture (name, width, height, ptexels, true, true, 1);
|
||||
|
|
|
@ -244,6 +244,8 @@ Cmd_StuffCmds_f (void)
|
|||
|
||||
// pull out the commands
|
||||
build = malloc (s + 1);
|
||||
if (!build)
|
||||
Sys_Error ("Cmd_StuffCmds_f: Memory Allocation Failure\n");
|
||||
build[0] = 0;
|
||||
|
||||
for (i = 0; i < s - 1; i++) {
|
||||
|
@ -339,16 +341,6 @@ Cmd_Echo_f (void)
|
|||
|
||||
Creates a new command that executes a command string (possibly ; seperated)
|
||||
*/
|
||||
char *
|
||||
CopyString (char *in)
|
||||
{
|
||||
char *out;
|
||||
|
||||
out = malloc (strlen (in) + 1);
|
||||
strcpy (out, in);
|
||||
return out;
|
||||
}
|
||||
|
||||
void
|
||||
Cmd_Alias_f (void)
|
||||
{
|
||||
|
@ -384,6 +376,8 @@ Cmd_Alias_f (void)
|
|||
|
||||
// copy the rest of the command line
|
||||
cmd = malloc (strlen (Cmd_Args (1)) + 2);// can never be longer
|
||||
if (!cmd)
|
||||
Sys_Error ("Cmd_Alias_f: Memory Allocation Failure\n");
|
||||
cmd[0] = 0; // start out with a null string
|
||||
c = Cmd_Argc ();
|
||||
for (i = 2; i < c; i++) {
|
||||
|
@ -545,6 +539,8 @@ Cmd_AddCommand (const char *cmd_name, xcommand_t function, const char *descripti
|
|||
}
|
||||
|
||||
cmd = malloc (sizeof (cmd_function_t));
|
||||
if (!cmd)
|
||||
Sys_Error ("Cmd_AddCommand: Memory_Allocation_Failure\n");
|
||||
cmd->name = cmd_name;
|
||||
cmd->function = function;
|
||||
cmd->description = description;
|
||||
|
@ -648,6 +644,8 @@ Cmd_CompleteBuildList (const char *partial)
|
|||
|
||||
len = strlen(partial);
|
||||
buf = malloc(sizeofbuf + sizeof (char *));
|
||||
if (!buf)
|
||||
Sys_Error ("Cmd_CompleteBuildList: Memory Allocation Failure\n");
|
||||
// Loop through the alias list and print all matches
|
||||
for (cmd = cmd_functions; cmd; cmd = cmd->next)
|
||||
if (!strncasecmp(partial, cmd->name, len))
|
||||
|
@ -734,6 +732,8 @@ Cmd_CompleteAliasBuildList (const char *partial)
|
|||
|
||||
len = strlen(partial);
|
||||
buf = malloc(sizeofbuf + sizeof (char *));
|
||||
if (!buf)
|
||||
Sys_Error ("Cmd_CompleteAliasBuildList: Memory Allocation Failure\n");
|
||||
// Loop through the alias list and print all matches
|
||||
for (alias = cmd_alias; alias; alias = alias->next)
|
||||
if (!strncasecmp(partial, alias->name, len))
|
||||
|
|
|
@ -214,6 +214,8 @@ Cvar_CompleteBuildList (const char *partial)
|
|||
|
||||
len = strlen(partial);
|
||||
buf = malloc(sizeofbuf + sizeof (char *));
|
||||
if (!buf)
|
||||
Sys_Error ("Cvar_CompleteBuildList: Memory Allocation Failure\n");
|
||||
// Loop through the alias list and print all matches
|
||||
for (cvar = cvar_vars; cvar; cvar = cvar->next)
|
||||
if (!strncasecmp(partial, cvar->name, len))
|
||||
|
|
|
@ -879,6 +879,8 @@ COM_LoadGameDirectory (const char *dir)
|
|||
}
|
||||
|
||||
pakfiles[count] = malloc (FNAME_SIZE);
|
||||
if (!pakfiles[count])
|
||||
Sys_Error ("COM_LoadGameDirectory: MemoryAllocationFailure\n");
|
||||
snprintf (pakfiles[count], FNAME_SIZE - 1, "%s/%s", dir,
|
||||
dirent->d_name);
|
||||
pakfiles[count][FNAME_SIZE - 1] = '\0';
|
||||
|
|
|
@ -383,8 +383,11 @@ Qgetline (VFile *file)
|
|||
static char *buf = 0;
|
||||
int len;
|
||||
|
||||
if (!buf)
|
||||
if (!buf) {
|
||||
buf = malloc (size);
|
||||
if (!buf)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!Qgets (file, buf, size))
|
||||
return 0;
|
||||
|
|
|
@ -108,6 +108,8 @@ LoadTGA (VFile *fin)
|
|||
numPixels = columns * rows;
|
||||
|
||||
targa_rgba = malloc (numPixels * 4);
|
||||
if (!targa_rgba)
|
||||
Sys_Error ("LoadTGA: Memory Allocation Failure\n");
|
||||
|
||||
if (targa_header.id_length != 0)
|
||||
Qseek (fin, targa_header.id_length, SEEK_CUR); // skip TARGA image
|
||||
|
|
|
@ -621,6 +621,8 @@ SCR_ScreenShot_f (void)
|
|||
return;
|
||||
}
|
||||
buffer = malloc (glwidth * glheight * 3);
|
||||
if (!buffer)
|
||||
Sys_Error ("SCR_ScreenShot_f: Memory Allocation Failure\n");
|
||||
qfglReadPixels (glx, gly, glwidth, glheight, GL_BGR_EXT, GL_UNSIGNED_BYTE,
|
||||
buffer);
|
||||
WriteTGAfile (pcxname, buffer, glwidth, glheight);
|
||||
|
|
|
@ -518,6 +518,8 @@ GL_Upload8 (byte * data, int width, int height, qboolean mipmap, qboolean alpha)
|
|||
|
||||
s = width * height;
|
||||
trans = malloc (s * sizeof (unsigned int));
|
||||
if (!trans)
|
||||
Sys_Error ("GL_Upload8: Memory Allocation Failure\n");
|
||||
|
||||
// if there are no transparent pixels, make it a 3 component
|
||||
// texture even if it was specified as otherwise
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#include <sys/ioctl.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "QF/sys.h"
|
||||
|
||||
#include "fbset.h"
|
||||
|
||||
struct file;
|
||||
|
@ -406,6 +408,8 @@ AddVideoMode (const struct VideoMode *vmode)
|
|||
Die("%s:%d: Duplicate mode name `%s'\n", Opt_modedb, line,
|
||||
vmode->name);
|
||||
vmode2 = malloc(sizeof(struct VideoMode));
|
||||
if (!vmode2)
|
||||
Sys_Error ("AddVideoMode: Memory Allocation Failure\n");
|
||||
*vmode2 = *vmode;
|
||||
if (!FillScanRates(vmode2))
|
||||
Die("%s:%d: Bad video mode `%s'\n", Opt_modedb, line, vmode2->name);
|
||||
|
|
|
@ -199,6 +199,8 @@ VID_MakeColormaps (int fullbrights, byte *pal)
|
|||
vid.colormap8 = malloc (256*VID_GRADES * sizeof (byte));
|
||||
vid.colormap16 = malloc (256*VID_GRADES * sizeof (short));
|
||||
vid.colormap32 = malloc (256*VID_GRADES * sizeof (int));
|
||||
if (!vid.colormap8 || !vid.colormap16 || !vid.colormap32)
|
||||
Sys_Error ("VID_MakeColormaps: Memory Allocation Failure\n");
|
||||
VID_MakeColormap8(vid.colormap8, pal);
|
||||
VID_MakeColormap16(vid.colormap16, pal);
|
||||
VID_MakeColormap32(vid.colormap32, pal);
|
||||
|
|
|
@ -267,6 +267,8 @@ VID_InitModes (void)
|
|||
/* Get complete information on all modes */
|
||||
num_modes = vga_lastmodenumber () + 1;
|
||||
modes = malloc (num_modes * sizeof (vga_modeinfo));
|
||||
if (!modes)
|
||||
Sys_Error ("VID_InitModes: Memory Allocation Failure\n");
|
||||
for (i = 0; i < num_modes; i++) {
|
||||
if (vga_hasmode (i)) {
|
||||
memcpy (&modes[i], vga_getmodeinfo (i), sizeof (vga_modeinfo));
|
||||
|
|
|
@ -294,6 +294,7 @@ static void
|
|||
ResetFrameBuffer (void)
|
||||
{
|
||||
int mem, pwidth;
|
||||
char *buf;
|
||||
|
||||
if (x_framebuffer[0]) {
|
||||
XDestroyImage (x_framebuffer[0]);
|
||||
|
@ -304,10 +305,13 @@ ResetFrameBuffer (void)
|
|||
if (pwidth == 3)
|
||||
pwidth = 4;
|
||||
mem = ((vid.width * pwidth + 7) & ~7) * vid.height;
|
||||
buf = malloc (mem);
|
||||
if (!buf)
|
||||
Sys_Error ("ResetFrameBuffer: Memory Allocation Failure\n");
|
||||
|
||||
// allocate new screen buffer
|
||||
x_framebuffer[0] = XCreateImage (x_disp, x_vis, x_visinfo->depth,
|
||||
ZPixmap, 0, malloc (mem), vid.width,
|
||||
ZPixmap, 0, buf, vid.width,
|
||||
vid.height, 32, 0);
|
||||
|
||||
if (!x_framebuffer[0]) {
|
||||
|
|
|
@ -793,12 +793,16 @@ Host_InitVCR (quakeparms_t *parms)
|
|||
|
||||
Qread (vcrFile, &com_argc, sizeof (int));
|
||||
com_argv = malloc (com_argc * sizeof (char *));
|
||||
if (!com_argv)
|
||||
Sys_Error ("Host_InitVCR: Memory Allocation Failure\n");
|
||||
|
||||
com_argv[0] = parms->argv[0];
|
||||
for (i = 0; i < com_argc; i++) {
|
||||
Qread (vcrFile, &len, sizeof (int));
|
||||
|
||||
p = malloc (len);
|
||||
if (!p)
|
||||
Sys_Error ("Host_InitVCR: Memory Allocation Failure\n");
|
||||
Qread (vcrFile, p, len);
|
||||
com_argv[i + 1] = p;
|
||||
}
|
||||
|
|
|
@ -100,6 +100,8 @@ locs_add (vec3_t location, const char *name)
|
|||
num = locations_count - 1;
|
||||
|
||||
locations[num] = malloc (sizeof (location_t));
|
||||
if (!locations[num])
|
||||
Sys_Error ("locs_add: Memory Allocation Failure\n");
|
||||
|
||||
locations[num]->loc[0] = location[0];
|
||||
locations[num]->loc[1] = location[1];
|
||||
|
|
|
@ -132,7 +132,8 @@ main (int argc, const char **argv)
|
|||
memset (&parms, 0, sizeof (parms));
|
||||
|
||||
parms.memsize = 16384 * 1024;
|
||||
parms.membase = malloc (parms.memsize);
|
||||
if (!(parms.membase = malloc (parms.memsize)))
|
||||
Sys_Error ("Can't allocate %d\n", parms.memsize);
|
||||
#if 0
|
||||
_getcwd (cwd, sizeof (cwd));
|
||||
if (cwd[Q_strlen (cwd) - 1] == '\\')
|
||||
|
|
|
@ -50,6 +50,7 @@ static const char rcsid[] =
|
|||
#include "QF/msg.h"
|
||||
#include "QF/screen.h"
|
||||
#include "QF/sound.h"
|
||||
#include "QF/sys.h"
|
||||
#include "QF/teamplay.h"
|
||||
#include "QF/va.h"
|
||||
#include "QF/vfile.h"
|
||||
|
@ -576,6 +577,8 @@ CL_StartUpload (byte * data, int size)
|
|||
Con_DPrintf ("Upload starting of %d...\n", size);
|
||||
|
||||
upload_data = malloc (size);
|
||||
if (!upload_data)
|
||||
Sys_Error ("CL_StartUpload: Memory Allocation Failure\n");
|
||||
memcpy (upload_data, data, size);
|
||||
upload_size = size;
|
||||
upload_pos = 0;
|
||||
|
|
|
@ -128,6 +128,8 @@ SL_Add (server_entry_t *start, char *ip, char *desc)
|
|||
start->next = 0;
|
||||
start->server = malloc (strlen (ip) + 1);
|
||||
start->desc = malloc (strlen (desc ? desc : ip) + 1);
|
||||
if (!start->server || !start->desc)
|
||||
Sys_Error ("SL_Add: Memory Allocation Failure\n");
|
||||
strcpy (start->server, ip);
|
||||
strcpy (start->desc, desc ? desc : ip);
|
||||
start->status = NULL;
|
||||
|
@ -143,6 +145,8 @@ SL_Add (server_entry_t *start, char *ip, char *desc)
|
|||
p->next->prev = p;
|
||||
p->next->server = malloc (strlen (ip) + 1);
|
||||
p->next->desc = malloc (strlen (desc ? desc : ip) + 1);
|
||||
if (!p->next->server || !p->next->desc)
|
||||
Sys_Error ("SL_Add: Memory Allocation Failure\n");
|
||||
|
||||
strcpy (p->next->server, ip);
|
||||
strcpy (p->next->desc, desc ? desc : ip);
|
||||
|
@ -186,6 +190,8 @@ SL_InsB (server_entry_t *start, server_entry_t *place, char *ip, char *desc)
|
|||
|
||||
new->server = malloc (strlen (ip) + 1);
|
||||
new->desc = malloc (strlen (desc) + 1);
|
||||
if (!new->server || !new->desc)
|
||||
Sys_Error ("SL_InsB: Memory Allocation Failure\n");
|
||||
strcpy (new->server, ip);
|
||||
strcpy (new->desc, desc);
|
||||
other = place->prev;
|
||||
|
@ -629,6 +635,8 @@ SL_LoadF (VFile *f, server_entry_t *start)
|
|||
if ((st = gettokstart (line, 1, ' ')) != NULL) {
|
||||
len = gettoklen (line, 1, ' ');
|
||||
addr = malloc (len + 1);
|
||||
if (!addr)
|
||||
Sys_Error ("SL_LoadF: Memory Allocation Failure\n");
|
||||
strncpy (addr, &line[0], len);
|
||||
addr[len] = '\0';
|
||||
if ((st = gettokstart (line, 2, ' '))) {
|
||||
|
|
|
@ -228,6 +228,9 @@ Sys_ConsoleInput (void)
|
|||
if (clipText) {
|
||||
textCopied =
|
||||
malloc (GlobalSize (th) + 1);
|
||||
if (!textCopied)
|
||||
Sys_Error ("Sys_ConsoleInput: "
|
||||
"Memory Allocation Failure\n");
|
||||
strcpy (textCopied, clipText);
|
||||
// Substitutes a NULL for every token
|
||||
strtok (textCopied, "\n\r\b");
|
||||
|
|
|
@ -102,6 +102,8 @@ locs_add (vec3_t location, const char *name)
|
|||
num = locations_count - 1;
|
||||
|
||||
locations[num] = malloc (sizeof (location_t));
|
||||
if (!locations[num])
|
||||
Sys_Error ("locs_add: Memory Allocation Failure\n");
|
||||
|
||||
locations[num]->loc[0] = location[0];
|
||||
locations[num]->loc[1] = location[1];
|
||||
|
|
|
@ -842,7 +842,6 @@ SV_SendServerInfoChange (const char *key, const char *value)
|
|||
|
||||
Examine or change the serverinfo string
|
||||
*/
|
||||
char *CopyString (char *s);
|
||||
void
|
||||
SV_Serverinfo_f (void)
|
||||
{
|
||||
|
@ -881,7 +880,6 @@ SV_Serverinfo_f (void)
|
|||
|
||||
Examine or change the serverinfo string
|
||||
*/
|
||||
char *CopyString (char *s);
|
||||
void
|
||||
SV_Localinfo_f (void)
|
||||
{
|
||||
|
|
|
@ -99,8 +99,6 @@ char *COM_Parse (char *data);
|
|||
extern char com_token[1024];
|
||||
extern qboolean com_eof;
|
||||
|
||||
char *copystring(char *s);
|
||||
|
||||
void CRC_Init(unsigned short *crcvalue);
|
||||
void CRC_ProcessByte(unsigned short *crcvalue, byte data);
|
||||
unsigned short CRC_Value(unsigned short crcvalue);
|
||||
|
|
|
@ -41,6 +41,8 @@
|
|||
#include <direct.h>
|
||||
#endif
|
||||
|
||||
#include <QF/sys.h>
|
||||
|
||||
#include "cmdlib.h"
|
||||
|
||||
#define PATHSEPERATOR '/'
|
||||
|
@ -152,16 +154,6 @@ ExpandPathAndArchive (char *path)
|
|||
return expanded;
|
||||
}
|
||||
|
||||
char *
|
||||
copystring (char *s)
|
||||
{
|
||||
char *b;
|
||||
|
||||
b = malloc (strlen (s) + 1);
|
||||
strcpy (b, s);
|
||||
return b;
|
||||
}
|
||||
|
||||
/*
|
||||
I_FloatTime
|
||||
*/
|
||||
|
|
|
@ -43,6 +43,8 @@
|
|||
#include <libc.h>
|
||||
#endif
|
||||
|
||||
#include <QF/sys.h>
|
||||
|
||||
#include "cmdlib.h"
|
||||
|
||||
#define PATHSEPERATOR '/'
|
||||
|
@ -249,6 +251,8 @@ LoadFile (char *filename, void **bufferptr)
|
|||
f = SafeOpenRead (filename);
|
||||
length = FileLength (f);
|
||||
buffer = malloc (length + 1);
|
||||
if (!buffer)
|
||||
Sys_Error ("LoadFile: Memory Allocation Failure\n");
|
||||
((char *) buffer)[length] = 0;
|
||||
SafeRead (f, buffer, length);
|
||||
fclose (f);
|
||||
|
|
|
@ -33,6 +33,7 @@ static const char rcsid[] =
|
|||
#include <stdlib.h>
|
||||
|
||||
#include <QF/mathlib.h>
|
||||
#include <QF/sys.h>
|
||||
#include <QF/va.h>
|
||||
|
||||
#include "qfcc.h"
|
||||
|
@ -286,6 +287,8 @@ new_label_expr (void)
|
|||
expr_t *l = new_expr ();
|
||||
l->type = ex_label;
|
||||
l->e.label.name = malloc (len);
|
||||
if (!l->e.label.name)
|
||||
Sys_Error ("new_label_expr: Memory Allocation Failure\n");
|
||||
sprintf (l->e.label.name, "$%s_%d", fname, lnum);
|
||||
return l;
|
||||
}
|
||||
|
@ -472,6 +475,8 @@ do_op_string (int op, expr_t *e1, expr_t *e2)
|
|||
case '+':
|
||||
len = strlen (s1) + strlen (s2) + 1;
|
||||
buf = malloc (len);
|
||||
if (!buf)
|
||||
Sys_Error ("do_op_string: Memory Allocation Failure\n");
|
||||
strcpy (buf, s1);
|
||||
strcat (buf, s2);
|
||||
e1->e.string_val = buf;
|
||||
|
@ -1235,6 +1240,8 @@ function_expr (expr_t *e1, expr_t *e2)
|
|||
expr_t *ret = new_expr ();
|
||||
ret->type = ex_def;
|
||||
ret->e.def = memcpy (malloc (sizeof (def_t)), &def_ret, sizeof (def_t));
|
||||
if (!ret->e.def)
|
||||
Sys_Error ("function_expr: Memory Allocation Failure\n");
|
||||
ret->e.def->type = ftype->aux_type;
|
||||
call->e.block.result = ret;
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ static const char rcsid[] =
|
|||
# include "config.h"
|
||||
#endif
|
||||
#include <QF/hash.h>
|
||||
#include <QF/sys.h>
|
||||
|
||||
#include "qfcc.h"
|
||||
|
||||
|
@ -196,6 +197,8 @@ PR_FreeLocation (def_t *def)
|
|||
|
||||
if (!free_free_locs) {
|
||||
free_free_locs = malloc (256 * sizeof (locref_t));
|
||||
if (!free_free_locs)
|
||||
Sys_Error ("PR_FreeLocation: Memory Allocation Failure\n");
|
||||
for (loc = free_free_locs; loc - free_free_locs < 255; loc++)
|
||||
loc->next = loc + 1;
|
||||
loc->next = 0;
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#include <QF/sys.h>
|
||||
|
||||
#include "qfcc.h"
|
||||
|
||||
|
@ -291,12 +292,16 @@ PR_FindType (type_t *type)
|
|||
|
||||
// allocate a new one
|
||||
check = malloc (sizeof (*check));
|
||||
if (!check)
|
||||
Sys_Error ("PR_FindType: Memory Allocation Failure\n");
|
||||
*check = *type;
|
||||
check->next = pr.types;
|
||||
pr.types = check;
|
||||
|
||||
// allocate a generic def for the type, so fields can reference it
|
||||
def = malloc (sizeof (def_t));
|
||||
if (!check)
|
||||
Sys_Error ("PR_FindType: Memory Allocation Failure\n");
|
||||
def->name = "COMPLEX TYPE";
|
||||
def->type = check;
|
||||
check->def = def;
|
||||
|
|
|
@ -32,6 +32,7 @@ static const char rcsid[] =
|
|||
"$Id$";
|
||||
|
||||
#include <QF/hash.h>
|
||||
#include <QF/sys.h>
|
||||
#include "qfcc.h"
|
||||
#include "scope.h"
|
||||
#include "qc-parse.h"
|
||||
|
@ -320,6 +321,8 @@ void
|
|||
add_frame_macro (char *token)
|
||||
{
|
||||
frame_t *frame = malloc (sizeof (frame_t));
|
||||
if (!frame)
|
||||
Sys_Error ("add_frame_macro: Memory Allocation Failure\n");
|
||||
|
||||
frame->name = strdup (token);
|
||||
frame->num = frame_number++;
|
||||
|
@ -342,6 +345,8 @@ make_string (char *token)
|
|||
pr_file_p = token;
|
||||
PR_LexString ();
|
||||
str = malloc (pr_token_len + 1);
|
||||
if (!str)
|
||||
Sys_Error ("make_string: Memory Allocation Failure\n");
|
||||
memcpy (str, pr_token, pr_token_len + 1);
|
||||
return str;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,8 @@ static const char rcsid[] =
|
|||
"$Id$";
|
||||
|
||||
#include "qfcc.h"
|
||||
#include "QF/hash.h"
|
||||
#include <QF/hash.h>
|
||||
#include <QF/sys.h>
|
||||
|
||||
#define YYDEBUG 1
|
||||
#define YYERROR_VERBOSE 1
|
||||
|
@ -841,6 +842,8 @@ scan_scope (hashtab_t *tab, def_t *scope)
|
|||
for (def = scope->scope_next; def; def = def->scope_next) {
|
||||
if (def->name && !def->removed) {
|
||||
def_state_t *ds = malloc (sizeof (def_state_t));
|
||||
if (!ds)
|
||||
Sys_Error ("scan_scope: Memory Allocation Failure\n");
|
||||
ds->def = def;
|
||||
ds->state = def->initialized;
|
||||
Hash_Add (tab, ds);
|
||||
|
@ -870,6 +873,8 @@ merge_local_inits (hashtab_t *dl_1, hashtab_t *dl_2)
|
|||
(*ds)->def->initialized = (*ds)->state;
|
||||
|
||||
nds = malloc (sizeof (def_state_t));
|
||||
if (!nds)
|
||||
Sys_Error ("merge_local_inits: Memory Allocation Failure\n");
|
||||
nds->def = (*ds)->def;
|
||||
nds->state = (*ds)->state && d->state;
|
||||
Hash_Add (tab, nds);
|
||||
|
|
|
@ -913,6 +913,7 @@ main (int argc, char **argv)
|
|||
int p, crc;
|
||||
double start, stop;
|
||||
int no_cpp = 0;
|
||||
void *mem;
|
||||
|
||||
start = Sys_DoubleTime ();
|
||||
|
||||
|
@ -1023,7 +1024,10 @@ main (int argc, char **argv)
|
|||
printf ("debug file: %s\n", debugfile);
|
||||
}
|
||||
|
||||
PR_BeginCompilation (malloc (0x100000), 0x100000);
|
||||
mem = malloc (0x100000);
|
||||
if (!mem)
|
||||
Sys_Error ("main: Memory Allocation Failure\n");
|
||||
PR_BeginCompilation (mem, 0x100000);
|
||||
|
||||
// compile all the files
|
||||
while ((src = COM_Parse (src))) {
|
||||
|
|
|
@ -35,6 +35,7 @@ static const char rcsid[] =
|
|||
#include <string.h>
|
||||
|
||||
#include <QF/progs.h>
|
||||
#include <QF/sys.h>
|
||||
|
||||
#include "def.h"
|
||||
|
||||
|
@ -105,6 +106,8 @@ fix_missing_globals (progs_t *pr, def_t *globals)
|
|||
}
|
||||
|
||||
progs = malloc (pr->progs_size + strings_size);
|
||||
if (!progs)
|
||||
Sys_Error ("fix_missing_globals: Memory Allocation Failure\n");
|
||||
memcpy (progs, pr->progs, pr->progs_size);
|
||||
|
||||
offs = progs->ofs_strings + progs->numstrings;
|
||||
|
|
|
@ -67,6 +67,8 @@ main ()
|
|||
Cvar_Init_Hash ();
|
||||
Cmd_Init_Hash ();
|
||||
membase = malloc (memsize);
|
||||
if (!membase)
|
||||
Sys_Error ("Memory Allocation Failure\n");
|
||||
Memory_Init (membase, memsize);
|
||||
Cvar_Init ();
|
||||
Cbuf_Init ();
|
||||
|
|
Loading…
Reference in a new issue