diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp index bcb0d8f78..fb4e53c03 100644 --- a/src/engine/server/server.cpp +++ b/src/engine/server/server.cpp @@ -3574,9 +3574,9 @@ const char *CServer::GetAnnouncementLine(char const *pFileName) std::vector v; char *pLine; - CLineReader *lr = new CLineReader(); - lr->Init(File); - while((pLine = lr->Get())) + CLineReader lr; + lr.Init(File); + while((pLine = lr.Get())) if(str_length(pLine)) if(pLine[0] != '#') v.push_back(pLine); diff --git a/src/engine/shared/datafile.cpp b/src/engine/shared/datafile.cpp index 75ab1a609..3db171bd2 100644 --- a/src/engine/shared/datafile.cpp +++ b/src/engine/shared/datafile.cpp @@ -591,6 +591,12 @@ CDataFileWriter::~CDataFileWriter() { free(m_pItemTypes); m_pItemTypes = 0; + for(int i = 0; i < m_NumItems; i++) + if(m_pItems[i].m_pData) + free(m_pItems[i].m_pData); + for(int i = 0; i < m_NumDatas; ++i) + if(m_pDatas[i].m_pCompressedData) + free(m_pDatas[i].m_pCompressedData); free(m_pItems); m_pItems = 0; free(m_pDatas); @@ -895,9 +901,15 @@ int CDataFileWriter::Finish() // free data for(int i = 0; i < m_NumItems; i++) + { free(m_pItems[i].m_pData); + m_pItems[i].m_pData = 0; + } for(int i = 0; i < m_NumDatas; ++i) + { free(m_pDatas[i].m_pCompressedData); + m_pDatas[i].m_pCompressedData = 0; + } io_close(m_File); m_File = 0;