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