Resolve alloc-dealloc-mismatch in CFile::FreeSymbols

==89545==ERROR: AddressSanitizer: alloc-dealloc-mismatch (operator new [] vs operator delete) on 0x5020001007f0
    f0 operator delete(void*, unsigned long) (/lib64/libasan.so.8+0xfe1f8)
    f1 InfFile::FreeSymbols() $GIT/cfile/inffile.cpp:63
    f2 InfFile::Close() $GIT/cfile/inffile.cpp:115
    f3 LoadServerConfigFile() $GIT/Descent3/dedicated_server.cpp:355

0x5020001007f0 is located 0 bytes inside of 11-byte region [0x5020001007f0,0x5020001007fb)
allocated by thread T0 here:
    f0 operator new[](unsigned long) (/lib64/libasan.so.8+0xfd458)
    f1 InfFile::AddSymbol(char const*, char const*) $GIT/cfile/inffile.cpp:49
    f2 InfFile::ParseLine(char*, int) $GIT/cfile/inffile.cpp:187
This commit is contained in:
Jan Engelhardt 2024-09-09 09:54:20 +02:00
parent dfa0560aff
commit 69dbf5bca7

View File

@ -60,7 +60,7 @@ void InfFile::FreeSymbols() {
while ((sym = m_sym_list.start()) != 0) {
sym = m_sym_list.unlink();
if (sym->t.text)
delete sym->t.text;
delete[] sym->t.text;
delete sym;
}
}