ROMManager: initialise filedata to nullptr

If a user manages to open a file as a ROM that is greater than 1 GiB,
it will cause a segmentation fault (a crash) in LoadROM due to a delete
being called on an uninitialised pointer, which is undefined behaviour.

Initialise filedata to nullptr to prevent this, as deleting a null
pointer is defined as a no-op.
This commit is contained in:
Rayyan Ansari 2023-11-05 20:21:16 +00:00
parent df571078cf
commit 0e4d082361
No known key found for this signature in database
GPG Key ID: 46A8D18E5BC49D84
1 changed files with 1 additions and 1 deletions

View File

@ -1109,7 +1109,7 @@ bool LoadROM(QStringList filepath, bool reset)
{
if (filepath.empty()) return false;
u8* filedata;
u8* filedata = nullptr;
u32 filelen;
std::string basepath;