munt / munt

A multi-platform software synthesiser emulating pre-GM MIDI devices such as the Roland MT-32, CM-32L, CM-64 and LAPC-I. In no way endorsed by or affiliated with Roland Corp.

Home Page:http://munt.sourceforge.net/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

(minor) ROMImage should be freed with `delete[]` to match its `new[]` allocation

kcgen opened this issue · comments

commented

The Address Sanitizer caught this:

2021-05-21_17-12

In ROMInfo.cpp, romImage's memory is allocated on line 227 with new[]:

Bit8u *data = new Bit8u[2 * partSize];

But it's released with delete (instead of delete[]) on line 273:

delete romImage;

But it's released with delete (instead of delete[]) on line 273:

delete romImage;

That's not it. The problematic delete is at #250
delete data;
which is a byte array... And all my code analysers are silent :/

@kcgen Please see if this is now fixed.

commented

That's fixed it!
Thank you @sergm.

You welcome!