SLUDGE: fix unmatched delete[] leaks
This commit is contained in:
parent
77d5c7235d
commit
839e7fb4d2
8 changed files with 18 additions and 18 deletions
|
@ -180,7 +180,7 @@ static builtReturn sayCore(int numParams, loadedFunction *fun, bool sayIt) {
|
||||||
fun->timeLeft = p;
|
fun->timeLeft = p;
|
||||||
//debugOut ("BUILTIN: sayCore: %s (%i)\n", newText, p);
|
//debugOut ("BUILTIN: sayCore: %s (%i)\n", newText, p);
|
||||||
fun->isSpeech = true;
|
fun->isSpeech = true;
|
||||||
delete newText;
|
delete[] newText;
|
||||||
newText = NULL;
|
newText = NULL;
|
||||||
return BR_KEEP_AND_PAUSE;
|
return BR_KEEP_AND_PAUSE;
|
||||||
}
|
}
|
||||||
|
@ -887,7 +887,7 @@ builtIn(setFont) {
|
||||||
if (!loadFont(fileNumber, newText, newHeight))
|
if (!loadFont(fileNumber, newText, newHeight))
|
||||||
return BR_ERROR;
|
return BR_ERROR;
|
||||||
// newDebug (" Done!");
|
// newDebug (" Done!");
|
||||||
delete newText;
|
delete[] newText;
|
||||||
|
|
||||||
return BR_CONTINUE;
|
return BR_CONTINUE;
|
||||||
}
|
}
|
||||||
|
@ -1862,7 +1862,7 @@ builtIn(statusText) {
|
||||||
return BR_ERROR;
|
return BR_ERROR;
|
||||||
trimStack(fun->stack);
|
trimStack(fun->stack);
|
||||||
setStatusBar(newText);
|
setStatusBar(newText);
|
||||||
delete newText;
|
delete[] newText;
|
||||||
return BR_CONTINUE;
|
return BR_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -231,10 +231,10 @@ bool setFloor(int fileNum) {
|
||||||
} while (madeChange);
|
} while (madeChange);
|
||||||
|
|
||||||
for (i = 0; i < currentFloor->numPolygons; i++) {
|
for (i = 0; i < currentFloor->numPolygons; i++) {
|
||||||
delete distanceMatrix[i];
|
delete[] distanceMatrix[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
delete distanceMatrix;
|
delete []distanceMatrix;
|
||||||
distanceMatrix = NULL;
|
distanceMatrix = NULL;
|
||||||
|
|
||||||
setResourceForFatal(-1);
|
setResourceForFatal(-1);
|
||||||
|
|
|
@ -76,7 +76,7 @@ char *getPrefsFilename(char *filename) {
|
||||||
|
|
||||||
char *joined = joinStrings(f, ".ini");
|
char *joined = joinStrings(f, ".ini");
|
||||||
|
|
||||||
delete filename;
|
delete[] filename;
|
||||||
filename = NULL;
|
filename = NULL;
|
||||||
return joined;
|
return joined;
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ void warning(const char *l) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void registerWindowForFatal() {
|
void registerWindowForFatal() {
|
||||||
delete fatalInfo;
|
delete[] fatalInfo;
|
||||||
fatalInfo =
|
fatalInfo =
|
||||||
joinStrings("There's an error with this SLUDGE game! If you're designing this game, please turn on verbose error messages in the project manager and recompile. If not, please contact the author saying where and how this problem occured.", "");
|
joinStrings("There's an error with this SLUDGE game! If you're designing this game, please turn on verbose error messages in the project manager and recompile. If not, please contact the author saying where and how this problem occured.", "");
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ int checkNew(const void *mem) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void setFatalInfo(const char *userFunc, const char *BIF) {
|
void setFatalInfo(const char *userFunc, const char *BIF) {
|
||||||
delete fatalInfo;
|
delete[] fatalInfo;
|
||||||
fatalInfo = new char[strlen(userFunc) + strlen(BIF) + 38];
|
fatalInfo = new char[strlen(userFunc) + strlen(BIF) + 38];
|
||||||
if (fatalInfo)
|
if (fatalInfo)
|
||||||
sprintf(fatalInfo, "Currently in this sub: %s\nCalling: %s", userFunc, BIF);
|
sprintf(fatalInfo, "Currently in this sub: %s\nCalling: %s", userFunc, BIF);
|
||||||
|
|
|
@ -266,7 +266,7 @@ bool initSludge(const char *filename) {
|
||||||
|
|
||||||
if (strcmp(checker, "okSoFar"))
|
if (strcmp(checker, "okSoFar"))
|
||||||
return fatal(ERROR_BAD_HEADER, filename);
|
return fatal(ERROR_BAD_HEADER, filename);
|
||||||
delete checker;
|
delete[] checker;
|
||||||
checker = NULL;
|
checker = NULL;
|
||||||
|
|
||||||
unsigned char customIconLogo = fp->readByte();
|
unsigned char customIconLogo = fp->readByte();
|
||||||
|
@ -509,7 +509,7 @@ bool initSludge(const char *filename) {
|
||||||
|
|
||||||
char *gameName = encodeFilename(gameNameOrig);
|
char *gameName = encodeFilename(gameNameOrig);
|
||||||
|
|
||||||
delete gameNameOrig;
|
delete[] gameNameOrig;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
changeToUserDir();
|
changeToUserDir();
|
||||||
|
@ -767,10 +767,10 @@ void finishFunction(loadedFunction *fun) {
|
||||||
pauseFunction(fun);
|
pauseFunction(fun);
|
||||||
if (fun->stack)
|
if (fun->stack)
|
||||||
fatal(ERROR_NON_EMPTY_STACK);
|
fatal(ERROR_NON_EMPTY_STACK);
|
||||||
delete fun->compiledLines;
|
delete[] fun->compiledLines;
|
||||||
for (a = 0; a < fun->numLocals; a++)
|
for (a = 0; a < fun->numLocals; a++)
|
||||||
unlinkVar(fun->localVars[a]);
|
unlinkVar(fun->localVars[a]);
|
||||||
delete fun->localVars;
|
delete[] fun->localVars;
|
||||||
unlinkVar(fun->reg);
|
unlinkVar(fun->reg);
|
||||||
delete fun;
|
delete fun;
|
||||||
fun = NULL;
|
fun = NULL;
|
||||||
|
@ -785,7 +785,7 @@ void abortFunction(loadedFunction *fun) {
|
||||||
delete fun->compiledLines;
|
delete fun->compiledLines;
|
||||||
for (a = 0; a < fun->numLocals; a++)
|
for (a = 0; a < fun->numLocals; a++)
|
||||||
unlinkVar(fun->localVars[a]);
|
unlinkVar(fun->localVars[a]);
|
||||||
delete fun->localVars;
|
delete[] fun->localVars;
|
||||||
unlinkVar(fun->reg);
|
unlinkVar(fun->reg);
|
||||||
if (fun->calledBy)
|
if (fun->calledBy)
|
||||||
abortFunction(fun->calledBy);
|
abortFunction(fun->calledBy);
|
||||||
|
|
|
@ -78,7 +78,7 @@ void addStatusBar() {
|
||||||
|
|
||||||
void setStatusBar(char *txt) {
|
void setStatusBar(char *txt) {
|
||||||
if (nowStatus->firstStatusBar) {
|
if (nowStatus->firstStatusBar) {
|
||||||
delete nowStatus->firstStatusBar->text;
|
delete[] nowStatus->firstStatusBar->text;
|
||||||
nowStatus->firstStatusBar->text = copyString(txt);
|
nowStatus->firstStatusBar->text = copyString(txt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ void killAllSpeech() {
|
||||||
while (speech->allSpeech) {
|
while (speech->allSpeech) {
|
||||||
killMe = speech->allSpeech;
|
killMe = speech->allSpeech;
|
||||||
speech->allSpeech = speech->allSpeech->next;
|
speech->allSpeech = speech->allSpeech->next;
|
||||||
delete killMe->textLine;
|
delete[] killMe->textLine;
|
||||||
delete killMe;
|
delete killMe;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -336,14 +336,14 @@ char *getTextFromAnyVar(const variable &from) {
|
||||||
builder2 = joinStrings(builder, " ");
|
builder2 = joinStrings(builder, " ");
|
||||||
if (!builder2)
|
if (!builder2)
|
||||||
return NULL;
|
return NULL;
|
||||||
delete builder;
|
delete[] builder;
|
||||||
grabText = getTextFromAnyVar(stacky->thisVar);
|
grabText = getTextFromAnyVar(stacky->thisVar);
|
||||||
builder = joinStrings(builder2, grabText);
|
builder = joinStrings(builder2, grabText);
|
||||||
if (!builder)
|
if (!builder)
|
||||||
return NULL;
|
return NULL;
|
||||||
delete grabText;
|
delete[] grabText;
|
||||||
grabText = NULL;
|
grabText = NULL;
|
||||||
delete builder2;
|
delete[] builder2;
|
||||||
builder2 = NULL;
|
builder2 = NULL;
|
||||||
stacky = stacky->next;
|
stacky = stacky->next;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue