Skip to content

Commit

Permalink
NEVERHOOD: Fix a memory leak when changing modules
Browse files Browse the repository at this point in the history
  • Loading branch information
bluegr committed Jun 9, 2013
1 parent a14cb19 commit f2d0f76
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions engines/neverhood/gamemodule.cpp
Expand Up @@ -440,6 +440,10 @@ void GameModule::checkRequests() {
void GameModule::createModule(int moduleNum, int which) {
debug("GameModule::createModule(%d, %d)", moduleNum, which);
_moduleNum = moduleNum;

if (_childObject)

This comment has been minimized.

Copy link
@lordhoto

lordhoto Jun 9, 2013

Contributor

That if check looks superflous. You can pass NULL-pointers to delete.

This comment has been minimized.

Copy link
@bluegr

bluegr Jun 9, 2013

Author Member

Yeah, indeed. I've removed the unneeded check in 9e0c843

delete _childObject;

switch (_moduleNum) {
case 1000:
setGlobalVar(V_MODULE_NAME, 0x03294419);
Expand Down

0 comments on commit f2d0f76

Please sign in to comment.