From eeb0165cd669ddcb1ac1b233d75d081a003208fb Mon Sep 17 00:00:00 2001 From: gfgtdf Date: Fri, 28 Apr 2017 00:12:58 +0200 Subject: [PATCH] fix memleak in mp lobby. --- src/game_initialization/lobby_info.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/game_initialization/lobby_info.cpp b/src/game_initialization/lobby_info.cpp index 376e1c7c2a4..4792c0daba6 100644 --- a/src/game_initialization/lobby_info.cpp +++ b/src/game_initialization/lobby_info.cpp @@ -190,7 +190,8 @@ bool lobby_info::process_gamelist_diff(const config& data) if(current_i->second->display_status == game_info::NEW) { // This means the game never made it through to the user interface, // so just deleting it is fine - // TODO: don't we have to delete the pointer or am i missing something? + // TODO: use std::unique_ptr instead of deleting manually. + delete current_i->second; games_by_id_.erase(current_i); } else { current_i->second->display_status = game_info::DELETED; @@ -253,7 +254,7 @@ void lobby_info::sync_games_display_status() game_info_map::iterator i = games_by_id_.begin(); while(i != games_by_id_.end()) { if(i->second->display_status == game_info::DELETED) { - // TODO: don't we have to delete the pointer or am i missing something? + delete i->second; i = games_by_id_.erase(i); } else { i->second->display_status = game_info::CLEAN;