Resolve alloc-dealloc-mismatch in OutrageMusicSeq::FreeList

Once a level is loaded/started, the program runs into:

==17675==ERROR: AddressSanitizer: alloc-dealloc-mismatch (operator new vs operator delete []) on 0x50800031be20
    f0 operator delete[](void*) (/lib64/libasan.so.8+0xfde68) (BuildId: 5615a04b8d0a5a8eafa661f7235e2d98fa2b9137)
    f1 OutrageMusicSeq::FreeList() $GIT/music/sequencer.cpp:675
    f2 OutrageMusicSeq::Shutdown() $GIT/music/sequencer.cpp:208
    f3 D3MusicStop() $GIT/Descent3/d3music.cpp:118
    f4 mmInterface::OnDestroy() $GIT/Descent3/mmItem.cpp:400
    f5 UIWindow::Destroy() $GIT/ui/UIWindow.cpp:203
    f6 MainMenu() $GIT/Descent3/menu.cpp:911
    f7 MainLoop() $GIT/Descent3/descent.cpp:546
    f8 Descent3() $GIT/Descent3/descent.cpp:508
    f9 oeD3LnxApp::run() $GIT/Descent3/sdlmain.cpp:151

0x50800031be20 is located 0 bytes inside of 88-byte region [0x50800031be20,0x50800031be78)
allocated by thread T0 here:
    f0 operator new(unsigned long) (/lib64/libasan.so.8+0xfd2f8) (BuildId: 5615a04b8d0a5a8eafa661f7235e2d98fa2b9137)
    f1 OutrageMusicSeq::AddToList(short, short, int, OutrageMusicSeq::music_ins const*) $GIT/music/sequencer.cpp:653
    f2 OutrageMusicSeq::LoadTheme(char const*) $GIT/music/omflex.cpp:310
    f3 OutrageMusicSeq::Init(char const*) $GIT/music/sequencer.cpp:198
    f4 D3MusicStart(char const*) $GIT/Descent3/d3music.cpp:80
    f5 mmInterface::Create() $GIT/Descent3/mmItem.cpp:353
    f6 MainMenu() $GIT/Descent3/menu.cpp:732
    f7 MainLoop() $GIT/Descent3/descent.cpp:546
    f8 Descent3() $GIT/Descent3/descent.cpp:508
    f9 oeD3LnxApp::run() $GIT/Descent3/sdlmain.cpp:151
This commit is contained in:
Jan Engelhardt 2024-08-29 23:44:18 +02:00
parent 571c0199e9
commit 1da600caf2

View File

@ -672,7 +672,7 @@ void OutrageMusicSeq::FreeList() {
while ((node = m_music_list.start())) {
node = m_music_list.unlink();
delete[] node;
delete node;
}
m_music_list.free();