diff --git a/src/game/client/components/statboard.cpp b/src/game/client/components/statboard.cpp index 987e8361d..232aaafa8 100644 --- a/src/game/client/components/statboard.cpp +++ b/src/game/client/components/statboard.cpp @@ -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); } diff --git a/src/game/client/components/statboard.h b/src/game/client/components/statboard.h index f58ee416c..7001c6c99 100644 --- a/src/game/client/components/statboard.h +++ b/src/game/client/components/statboard.h @@ -11,7 +11,7 @@ class CStatboard: public CComponent void AutoStatScreenshot(); void AutoStatCSV(); - char* m_CSVstr; + char* m_pCSVstr; char* ReplaceCommata(char* pStr); void FormatStats();