Skip to content

Commit

Permalink
Fix memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
CodingJellyfish committed Nov 2, 2024
1 parent 4c23106 commit 64d36b2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
8 changes: 1 addition & 7 deletions src/config/favorite_status.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,7 @@ FavoriteStatus::FavoriteStatus(const XMLNode* node, std::string parse_type)
m_favorite[temp_group_string].insert(temp_string);
}
}
} // FavoriteStatus

//------------------------------------------------------------------------------
FavoriteStatus::~FavoriteStatus()
{

} // ~FavoriteStatus
} // FavoriteStatu

//------------------------------------------------------------------------------
/** Adds a new favorite track to this player profile and to the group
Expand Down
2 changes: 0 additions & 2 deletions src/config/favorite_status.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ class FavoriteStatus
/** Parse all <(parse_type)/> in <favorite> in xml node */
FavoriteStatus(const XMLNode *node, std::string parse_type);

virtual ~FavoriteStatus();

void save(UTFWriter &out);

bool isFavorite(std::string ident);
Expand Down
19 changes: 16 additions & 3 deletions src/config/player_profile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,22 @@ PlayerProfile::PlayerProfile(const XMLNode* node)
//------------------------------------------------------------------------------
PlayerProfile::~PlayerProfile()
{
delete m_story_mode_status;
delete m_achievements_status;
delete m_favorite_track_status;
if (m_story_mode_status)
{
delete m_story_mode_status;
}
if (m_achievements_status)
{
delete m_achievements_status;
}
if (m_favorite_track_status)
{
delete m_favorite_track_status;
}
if (m_favorite_kart_status)
{
delete m_favorite_kart_status;
}
#ifdef DEBUG
m_magic_number = 0xDEADBEEF;
#endif
Expand Down

0 comments on commit 64d36b2

Please sign in to comment.