Fix majors memory leaks (TODO: shared_ptr for Game objects and implement ~Game())

This commit is contained in:
Loic Guegan 2022-02-28 18:51:47 +01:00
parent 8f1e8fa106
commit a8c59c41bc
12 changed files with 40 additions and 4 deletions

View file

@ -6,6 +6,10 @@ PGNGameBase::PGNGameBase(std::string pgn_file) : pgn(new pgnp::PGN()) {
pgn->FromFile(pgn_file);
}
PGNGameBase::~PGNGameBase() {
delete pgn; // Should never fail since pgn is never NULL
}
bool PGNGameBase::NextGame() {
bool game_found = false;
try {

View file

@ -8,6 +8,7 @@ class PGNGameBase : public GameBase {
public:
PGNGameBase(std::string pgn_file);
~PGNGameBase();
Game *GetGame(std::uint32_t id);
bool NextGame();
Game *GetCurrentGame();