mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Put CLineReader on stack so we can't forget to delete it
Found in https://github.com/ddnet/ddnet/issues/3134 Direct leak of 360712 byte(s) in 11 object(s) allocated from: #0 0x51fb22 in operator new(unsigned long) (/home/teeworlds/servers/DDNet-Server-asan+0x51fb22) #1 0x561d77 in CServer::GetAnnouncementLine(char const*) /home/teeworlds/src/master/src/engine/server/server.cpp:3563:20 #2 0x5c00a7 in CGameContext::OnTick() /home/teeworlds/src/master/src/game/server/gamecontext.cpp:971:32 #3 0x556073 in CServer::Run() /home/teeworlds/src/master/src/engine/server/server.cpp:2544:19 #4 0x561a56 in main /home/teeworlds/src/master/src/engine/server/server.cpp:3537:21 #5 0x7f2349f3809a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a)
This commit is contained in:
parent
b3769a069c
commit
1081a6870c
|
@ -3560,9 +3560,9 @@ const char *CServer::GetAnnouncementLine(char const *pFileName)
|
|||
|
||||
std::vector<char *> 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);
|
||||
|
|
Loading…
Reference in a new issue