Audit more globals not being set correctly to NULL.

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1850 4a71c877-e1ca-e34f-864e-861f7616d084
master
Per Inge Mathisen 2007-06-12 17:56:34 +00:00
parent 6b9e5043be
commit 077433f02f
5 changed files with 14 additions and 0 deletions

View File

@ -622,6 +622,8 @@ void pie_CleanUp( void )
{
free( tshapes );
free( scshapes );
tshapes = NULL;
scshapes = NULL;
}
void pie_Draw3DShape(iIMDShape *shape, int frame, int team, UDWORD col, UDWORD spec, int pieFlag, int pieFlagData)

View File

@ -119,6 +119,7 @@ void pal_ShutDown(void)
{
bPaletteInitialised = FALSE;
free(psGamePal);
psGamePal = NULL;
}
}

View File

@ -175,10 +175,12 @@ void eventShutDown(void)
if (asCreateFuncs)
{
free(asCreateFuncs);
asCreateFuncs = NULL;
}
if (asReleaseFuncs)
{
free(asReleaseFuncs);
asReleaseFuncs = NULL;
}
}
@ -761,6 +763,7 @@ BOOL eventSetContextVar(SCRIPT_CONTEXT *psContext, UDWORD index, INTERP_VAL *dat
strcpy(psVal->v.sval, data->v.sval);
free(data->v.sval); //not needed anymore
data->v.sval = NULL;
}
else
{

View File

@ -1213,6 +1213,7 @@ static inline void destroyVarEnvironment(SCRIPT_CONTEXT *psContext, UDWORD envIn
}
free( varEnvironment[envIndex] );
varEnvironment[envIndex] = NULL;
}
}

View File

@ -92,6 +92,7 @@ static BOOL stackNewChunk(UDWORD size)
if (!psCurrChunk->psNext->aVals)
{
free(psCurrChunk->psNext);
psCurrChunk->psNext = NULL;
return FALSE;
}
@ -131,7 +132,10 @@ BOOL stackPush(INTERP_VAL *psVal)
{
/* free stack var allocated string memory, if stack var used to be of type VAL_STRING */
if(psCurrChunk->aVals[currEntry].type == VAL_STRING)
{
free(psCurrChunk->aVals[currEntry].v.sval); //don't need it anymore
psCurrChunk->aVals[currEntry].v.sval = NULL;
}
/* copy type/data as union */
memcpy(&(psCurrChunk->aVals[currEntry]), psVal, sizeof(INTERP_VAL));
@ -453,7 +457,10 @@ BOOL stackPushResult(INTERP_TYPE type, INTERP_VAL *result)
{
/* free stack var allocated string memory, if stack var used to be of type VAL_STRING */
if(psCurrChunk->aVals[currEntry].type == VAL_STRING)
{
free(psCurrChunk->aVals[currEntry].v.sval); //don't need it anymore
psCurrChunk->aVals[currEntry].v.sval = NULL;
}
/* copy type/data as union */
memcpy(&(psCurrChunk->aVals[currEntry]), result, sizeof(INTERP_VAL));