Skip to content

Commit

Permalink
Merge pull request #97 from MartinGuehmann/FixLeaks
Browse files Browse the repository at this point in the history
Fix memory leaks
  • Loading branch information
MartinGuehmann committed Feb 25, 2019
2 parents 2caf1af + 784c417 commit f8f1c59
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
5 changes: 2 additions & 3 deletions ctp2_code/gs/gameobj/CityData.cpp
Expand Up @@ -1316,6 +1316,7 @@ CityData::CityData(CivArchive &archive)
}

CityData::CityData(CityData *copy)
: m_name(NULL)
{
m_distanceToGood = new sint32[g_theResourceDB->NumRecords()];
m_happy = new Happy;
Expand Down Expand Up @@ -1485,9 +1486,7 @@ void CityData::Copy(CityData *copy)

m_happy->Copy(copy->m_happy);

size_t len = (strlen(copy->m_name) + 1) * sizeof(MBCHAR);
m_name = new MBCHAR[len];
memcpy(m_name, copy->m_name, len);
SetNameLocal(copy->m_name);
memcpy(m_distanceToGood, copy->m_distanceToGood, sizeof(sint32) * g_theResourceDB->NumRecords());
m_defensiveBonus = copy->m_defensiveBonus;

Expand Down
1 change: 1 addition & 0 deletions ctp2_code/ui/aui_ctp2/radarmap.cpp
Expand Up @@ -137,6 +137,7 @@ RadarMap::RadarMap(AUI_ERRCODE *retval,
//---------------------------------------------------------------------------
RadarMap::~RadarMap()
{
delete[] m_mapOverlay;
delete m_mapSurface;
delete m_tempSurface;
if (m_tempBuffer)
Expand Down

0 comments on commit f8f1c59

Please sign in to comment.