mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-16 22:58:09 +00:00
KYRA: (DOS/Floppy) - add some sanity checks/errors
(these never get triggered, but this isn't obvious, neither to static checkers nor to human beings)
This commit is contained in:
parent
4dd8a1df3e
commit
424eb6d7a7
@ -1088,6 +1088,9 @@ Common::Archive *InstallerLoader::load(Resource *owner, const Common::String &fi
|
||||
newEntry.name = entryStr;
|
||||
}
|
||||
|
||||
// The pointer (and the responsibility for the deletion) has been
|
||||
// passed on. Clear the variable as a signal that it can be reused.
|
||||
outbuffer = nullptr;
|
||||
fileList.push_back(newEntry);
|
||||
}
|
||||
pos++;
|
||||
@ -1136,6 +1139,12 @@ Common::Archive *InstallerLoader::load(Resource *owner, const Common::String &fi
|
||||
pos += (kHeaderSize + filestrlen - m);
|
||||
tmpFile->seek(pos, SEEK_SET);
|
||||
|
||||
if (outbuffer) {
|
||||
delete[] outbuffer;
|
||||
// We can prevent memory leakage, but we should never arrive here, since we still have unprocessed data in the outbuffer.
|
||||
error("InstallerLoader::load(): Unknown decompression failure.");
|
||||
}
|
||||
|
||||
outbuffer = new uint8[outsize];
|
||||
if (!outbuffer)
|
||||
error("Out of memory: Can't uncompress installer files");
|
||||
@ -1177,6 +1186,7 @@ Common::Archive *InstallerLoader::load(Resource *owner, const Common::String &fi
|
||||
newEntry.name = entryStr;
|
||||
}
|
||||
|
||||
outbuffer = nullptr;
|
||||
fileList.push_back(newEntry);
|
||||
}
|
||||
|
||||
@ -1195,6 +1205,12 @@ Common::Archive *InstallerLoader::load(Resource *owner, const Common::String &fi
|
||||
}
|
||||
}
|
||||
|
||||
if (outbuffer) {
|
||||
delete[] outbuffer;
|
||||
// We can prevent memory leakage, but we should never arrive here, since we still have unprocessed data in the outbuffer.
|
||||
error("InstallerLoader::load(): Unknown decompression failure.");
|
||||
}
|
||||
|
||||
archives.clear();
|
||||
return new CachedArchive(fileList);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user