Skip to content

Commit

Permalink
Fixed|libdoomsday: Potential memory leak
Browse files Browse the repository at this point in the history
Normally only one instance of Players is constructed, but since the
players were constructed by the class, it should also delete them.
  • Loading branch information
skyjake committed Jun 11, 2016
1 parent 9e7a2be commit 92ca8d0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions doomsday/apps/libdoomsday/src/players.cpp
Expand Up @@ -29,6 +29,15 @@ DENG2_PIMPL_NOREF(Players)
{
zap(players);
}

~Instance()
{
for (auto *plr : players)
{
delete plr;
}
zap(players);
}
};

Players::Players(Constructor playerConstructor) : d(new Instance)
Expand Down

0 comments on commit 92ca8d0

Please sign in to comment.