Commit 917da2e3 authored by Richard Gobeille's avatar Richard Gobeille

engine and Duke3d: fix a bunch of direct calls to libc free() to call Bfree() instead

parent 786869b1
......@@ -50,7 +50,7 @@ struct GrowArray
{
size_ = 0;
capacity_ = 0;
free(data_);
Bfree(data_);
data_ = nullptr;
}
......
......@@ -753,7 +753,7 @@ int app_main(int argc, char const * const * argv)
initprintf("Definitions file \"%s\" loaded.\n",defsfile);
for (char * m : g_defModules)
free(m);
Bfree(m);
g_defModules.clear();
if (enginePostInit())
......@@ -803,7 +803,7 @@ int app_main(int argc, char const * const * argv)
initprintf("There was an error loading the sprite clipping map (status %d).\n", k);
for (char * f : g_clipMapFiles)
free(f);
Bfree(f);
g_clipMapFiles.clear();
#endif
......
......@@ -499,10 +499,10 @@ static GLuint polymost2_compileShader(GLenum shaderType, const char* const sourc
OSD_Printf("Compile Status: %u\n", compileStatus);
if (logLength > 0)
{
char *infoLog = (char*)Xmalloc(logLength);
char *infoLog = (char*)Bmalloc(logLength);
glGetShaderInfoLog(shaderID, logLength, &logLength, infoLog);
OSD_Printf("Log:\n%s\n", infoLog);
free(infoLog);
Bfree(infoLog);
}
}
......@@ -1134,7 +1134,7 @@ void polymost_glinit()
glLinkProgram(polymost1ExtendedShaderProgramID);
int polymost1BasicFragLen = strlen(polymost1Frag);
char* polymost1BasicFrag = (char*) malloc(polymost1BasicFragLen);
char* polymost1BasicFrag = (char*) Bmalloc(polymost1BasicFragLen);
memcpy(polymost1BasicFrag, polymost1Frag, polymost1BasicFragLen);
char* extDefineSubstr = strstr(polymost1BasicFrag, " #define POLYMOST1_EXTENDED");
if (extDefineSubstr)
......@@ -1148,7 +1148,7 @@ void polymost_glinit()
glAttachShader(polymost1BasicShaderProgramID, polymost1BasicVertexShaderID);
glAttachShader(polymost1BasicShaderProgramID, polymost1BasicFragmentShaderID);
glLinkProgram(polymost1BasicShaderProgramID);
free(polymost1BasicFrag);
Bfree(polymost1BasicFrag);
polymost1BasicFrag = 0;
// set defaults
......
......@@ -123,7 +123,7 @@ void artClearMapArt(void)
{
if (faketiledata[i] != g_bakFakeTileData[i])
{
free(faketiledata[i]);
Bfree(faketiledata[i]);
faketiledata[i] = g_bakFakeTileData[i];
}
}
......@@ -225,7 +225,7 @@ static void tileSetDataSafe(int32_t const tile, int32_t tsiz, char const * const
}
else
{
free(newtile);
Bfree(newtile);
}
}
......
......@@ -9892,7 +9892,7 @@ static int32_t loadconsounds(const char *fn)
for (char * m : g_scriptModules)
{
parseconsounds_include(m, NULL, "null");
free(m);
Bfree(m);
}
g_scriptModules.clear();
......
......@@ -418,7 +418,7 @@ void G_CheckCommandLine(int32_t argc, char const * const * argv)
{
if (argc > i+1)
{
free(g_rtsNamePtr);
Bfree(g_rtsNamePtr);
g_rtsNamePtr = dup_filename(argv[i+1]);
initprintf("Using RTS file \"%s\".\n", g_rtsNamePtr);
i++;
......@@ -810,7 +810,7 @@ void G_CheckCommandLine(int32_t argc, char const * const * argv)
}
if (!Bstrcasecmp(k, ".rts"))
{
free(g_rtsNamePtr);
Bfree(g_rtsNamePtr);
g_rtsNamePtr = dup_filename(argv[i++]);
initprintf("Using RTS file \"%s\".\n", g_rtsNamePtr);
continue;
......
......@@ -39,11 +39,11 @@ static const char *defaultdeffilename[GAMECOUNT] = { "duke3d.def", "nam.def"
static const char *defaultgameconfilename[GAMECOUNT] = { "EDUKE.CON", "NAM.CON", "NAPALM.CON", "WW2GI.CON" };
#endif
// g_grpNamePtr can ONLY point to a malloc'd block (length BMAX_PATH)
// g_grpNamePtr can ONLY point to a Bmalloc'd block (length BMAX_PATH)
char *g_grpNamePtr = NULL;
// g_scriptNamePtr can ONLY point to a malloc'd block (length BMAX_PATH)
// g_scriptNamePtr can ONLY point to a Bmalloc'd block (length BMAX_PATH)
char *g_scriptNamePtr = NULL;
// g_rtsNamePtr can ONLY point to a malloc'd block (length BMAX_PATH)
// g_rtsNamePtr can ONLY point to a Bmalloc'd block (length BMAX_PATH)
char *g_rtsNamePtr = NULL;
void clearGrpNamePtr(void)
......
......@@ -6650,7 +6650,7 @@ int app_main(int argc, char const* const* argv)
loaddefinitions_game(defsfile, FALSE);
for (char * m : g_defModules)
free(m);
Bfree(m);
g_defModules.clear();
cacheAllSounds();
......@@ -6726,7 +6726,7 @@ int app_main(int argc, char const* const* argv)
initprintf("There was an error loading the sprite clipping map (status %d).\n", clipMapError);
for (char * m : g_clipMapFiles)
free(m);
Bfree(m);
g_clipMapFiles.clear();
#endif
......
......@@ -6409,7 +6409,7 @@ void C_Compile(const char *fileName)
for (char * m : g_scriptModules)
{
C_Include(m);
free(m);
Bfree(m);
}
g_scriptModules.clear();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment