fix memleak in mp lobby.

This commit is contained in:
gfgtdf 2017-04-28 00:12:58 +02:00 committed by GitHub
parent b8a76bed9d
commit eeb0165cd6

View file

@ -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;