Skip to content

Commit

Permalink
Fix MapEdit memory errors
Browse files Browse the repository at this point in the history
deleteThis() was called on NULL pointers.
Deleting individual nodes shouldn't be necessary if the whole structure
(pkvFile) is deleted anyways.
  • Loading branch information
z33ky committed May 23, 2021
1 parent f2693e4 commit 37a86e5
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions sp/src/game/shared/mapbase/MapEdit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,6 @@ class CMapEdit : public CAutoGameSystemPerFrame

pkvClassname = pkvClassname->GetNextKey();
}
pkvClassname->deleteThis();
}
else if (FStrEq(pNodeName, "edit"))
{
Expand All @@ -432,7 +431,6 @@ class CMapEdit : public CAutoGameSystemPerFrame

pName = pName->GetNextKey();
}
pName->deleteThis();
}
else if (FStrEq(pNodeName, "delete"))
{
Expand All @@ -455,7 +453,6 @@ class CMapEdit : public CAutoGameSystemPerFrame

pName = pName->GetNextKey();
}
pName->deleteThis();
}
else if (FStrEq(pNodeName, "fire"))
{
Expand Down Expand Up @@ -525,12 +522,10 @@ class CMapEdit : public CAutoGameSystemPerFrame

pkvNodeData = pkvNodeData->GetNextKey();
}
pkvNodeData->deleteThis();
}

pkvNode = pkvNode->GetNextKey();
}
pkvNode->deleteThis();
}

void SpawnMapEdit(const char *pFile = NULL)
Expand Down Expand Up @@ -889,8 +884,8 @@ void CC_MapEdit_Print( const CCommand& args )
pkvNode = pkvNode->GetNextKey();
}

pkvNode->deleteThis();
}
pkvFile->deleteThis();
}
}
static ConCommand mapedit_print("mapedit_print", CC_MapEdit_Print, "Prints a mapedit file in the console.");
Expand Down

0 comments on commit 37a86e5

Please sign in to comment.