Fix memory leaks reported by cppcheck
parent
4fb9e61548
commit
64f1b6b895
|
@ -172,6 +172,7 @@ BOOL anim_Create3D(char szPieFileName[], UWORD uwStates, UWORD uwFrameRate, UWOR
|
|||
if ( ubType == ANIM_3D_TRANS && uwObj != uwFrames )
|
||||
{
|
||||
ASSERT(false, "Frames in pie %s != script objects %i", szPieFileName, uwObj);
|
||||
free(psAnim3D);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -415,6 +415,7 @@ BOOL eventNewContext(SCRIPT_CODE *psCode, CONTEXT_RELEASE release,
|
|||
if (!asCreateFuncs[type](&(psCode->ppsLocalVarVal[i][j]) ))
|
||||
{
|
||||
debug(LOG_ERROR,"eventNewContext: asCreateFuncs failed for local var");
|
||||
free(psContext);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -671,9 +671,7 @@ bool seq_Play(const char* filename)
|
|||
/* open video */
|
||||
if (theora_p)
|
||||
{
|
||||
char *blackframe = (char *)calloc(1, texture_width * texture_height * 4);
|
||||
if (videodata.ti.frame_width > texture_width ||
|
||||
videodata.ti.frame_height > texture_height)
|
||||
if (videodata.ti.frame_width > texture_width || videodata.ti.frame_height > texture_height)
|
||||
{
|
||||
debug(LOG_ERROR, "Video size too large, must be below %dx%d!",
|
||||
texture_width, texture_height);
|
||||
|
@ -684,6 +682,7 @@ bool seq_Play(const char* filename)
|
|||
debug(LOG_ERROR, "Video not in YUV420 format!");
|
||||
return false;
|
||||
}
|
||||
char *blackframe = (char *)calloc(1, texture_width * texture_height * 4);
|
||||
Allocate_videoFrame();
|
||||
|
||||
glGenTextures(1, &video_texture);
|
||||
|
|
|
@ -270,14 +270,13 @@ void clearOverrideMods(void)
|
|||
|
||||
void addLoadedMod(const char * modname)
|
||||
{
|
||||
char * mod = strdup(modname);
|
||||
int i, modlen;
|
||||
if (num_loaded_mods >= MAX_MODS)
|
||||
{
|
||||
// mod list full
|
||||
return;
|
||||
}
|
||||
modlen = strlen(mod);
|
||||
char *mod = strdup(modname);
|
||||
int modlen = strlen(mod);
|
||||
if (modlen >= 3 && strcmp(&mod[modlen-3], ".wz")==0)
|
||||
{
|
||||
// remove ".wz" from end
|
||||
|
@ -305,7 +304,8 @@ void addLoadedMod(const char * modname)
|
|||
// Yes, this is an online insertion sort.
|
||||
// I swear, for the numbers of mods this is going to be dealing with
|
||||
// (i.e. 0 to 2), it really is faster than, say, Quicksort.
|
||||
for (i=0; i<num_loaded_mods && strcmp(loaded_mods[i], mod)>0; i++) {}
|
||||
int i;
|
||||
for (i = 0; i < num_loaded_mods && strcmp(loaded_mods[i], mod) > 0; i++) {}
|
||||
if (i < num_loaded_mods)
|
||||
{
|
||||
if (strcmp(loaded_mods[i], mod) == 0)
|
||||
|
|
Loading…
Reference in New Issue