Sticking to naming convention. Freeing allocated memory.

This commit is contained in:
SheikhZayx 2017-05-08 21:55:03 +02:00
parent 80737e9c57
commit 451e5dfcf4
2 changed files with 12 additions and 8 deletions

View file

@ -14,7 +14,7 @@ CStatboard::CStatboard()
m_Active = false;
m_ScreenshotTaken = false;
m_ScreenshotTime = -1;
m_CSVstr = 0;
m_pCSVstr = 0;
}
void CStatboard::OnReset()
@ -419,9 +419,11 @@ void CStatboard::AutoStatCSV()
FormatStats();
unsigned int len = str_length(m_CSVstr);
char* buf = new char[len];
mem_copy(buf, m_CSVstr, len);
unsigned int len = str_length(m_pCSVstr);
char* buf = (char*)mem_alloc(len, 0);
mem_copy(buf, m_pCSVstr, len);
mem_free(m_pCSVstr);
if(File)
{
@ -429,6 +431,8 @@ void CStatboard::AutoStatCSV()
io_close(File);
}
mem_free(buf);
Client()->AutoCSV_Start();
}
}
@ -557,7 +561,7 @@ void CStatboard::FormatStats()
str_format(aStats, sizeof(aStats), "%s\n\n%s", aServerStats, aPlayerStats);
unsigned int len = str_length(aStats);
m_CSVstr = new char[len];
mem_zero(m_CSVstr, len);
str_copy(m_CSVstr, aStats, len);
m_pCSVstr = (char*)mem_alloc(len, 0);
mem_zero(m_pCSVstr, len);
str_copy(m_pCSVstr, aStats, len);
}

View file

@ -11,7 +11,7 @@ class CStatboard: public CComponent
void AutoStatScreenshot();
void AutoStatCSV();
char* m_CSVstr;
char* m_pCSVstr;
char* ReplaceCommata(char* pStr);
void FormatStats();