Commit 5256838e authored by Julian Helfferich's avatar Julian Helfferich 💬
Browse files

Fix memory leak in main

Create KBlocksConfigManager on the stack to ensure that it is deleted
when it goes out of scope.
parent 2bc7a8fd
......@@ -380,8 +380,8 @@ int main(int argc, char *argv[])
QByteArray tmpFileArray = parser.value(QStringLiteral("conf")).toLatin1();
const char *tmpFileChar = tmpFileArray.data();
KBlocksConfigManager *config = new KBlocksConfigManager();
config->LoadConfigFile(string(tmpFileChar));
KBlocksConfigManager config;
config.LoadConfigFile(string(tmpFileChar));
int mResult = 0;
switch (mGameMode) {
......@@ -389,16 +389,16 @@ int main(int argc, char *argv[])
mResult = gameDesktopMode(app);
break;
case KBlocksGame_EngineMode:
mResult = gameEngineMode(config);
mResult = gameEngineMode(&config);
break;
case KBlocksGame_GuiMode:
mResult = gameGuiMode(config, app);
mResult = gameGuiMode(&config, app);
break;
case KBlocksGame_PlayerMode:
mResult = gamePlayerMode(config, app);
mResult = gamePlayerMode(&config, app);
break;
case KBlocksGame_ReplayMode:
mResult = gameReplayMode(config, app);
mResult = gameReplayMode(&config, app);
break;
}
......
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