mirror of
https://github.com/libretro/scummvm.git
synced 2024-11-27 11:20:40 +00:00
PRINCE: Remove delete nullptr. PVS-Studio V575
This commit is contained in:
parent
754632401f
commit
a74857e957
@ -227,7 +227,6 @@ bool PrinceEngine::loadAnim(uint16 animNr, bool loop) {
|
|||||||
bool PrinceEngine::loadZoom(byte *zoomBitmap, uint32 dataSize, const char *resourceName) {
|
bool PrinceEngine::loadZoom(byte *zoomBitmap, uint32 dataSize, const char *resourceName) {
|
||||||
Common::SeekableReadStream *stream = SearchMan.createReadStreamForMember(resourceName);
|
Common::SeekableReadStream *stream = SearchMan.createReadStreamForMember(resourceName);
|
||||||
if (!stream) {
|
if (!stream) {
|
||||||
delete stream;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
stream = Resource::getDecompressedStream(stream);
|
stream = Resource::getDecompressedStream(stream);
|
||||||
@ -244,7 +243,6 @@ bool PrinceEngine::loadZoom(byte *zoomBitmap, uint32 dataSize, const char *resou
|
|||||||
bool PrinceEngine::loadShadow(byte *shadowBitmap, uint32 dataSize, const char *resourceName1, const char *resourceName2) {
|
bool PrinceEngine::loadShadow(byte *shadowBitmap, uint32 dataSize, const char *resourceName1, const char *resourceName2) {
|
||||||
Common::SeekableReadStream *stream = SearchMan.createReadStreamForMember(resourceName1);
|
Common::SeekableReadStream *stream = SearchMan.createReadStreamForMember(resourceName1);
|
||||||
if (!stream) {
|
if (!stream) {
|
||||||
delete stream;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,7 +257,6 @@ bool PrinceEngine::loadShadow(byte *shadowBitmap, uint32 dataSize, const char *r
|
|||||||
Common::SeekableReadStream *stream2 = SearchMan.createReadStreamForMember(resourceName2);
|
Common::SeekableReadStream *stream2 = SearchMan.createReadStreamForMember(resourceName2);
|
||||||
if (!stream2) {
|
if (!stream2) {
|
||||||
delete stream;
|
delete stream;
|
||||||
delete stream2;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,7 +278,6 @@ bool PrinceEngine::loadShadow(byte *shadowBitmap, uint32 dataSize, const char *r
|
|||||||
bool PrinceEngine::loadTrans(byte *transTable, const char *resourceName) {
|
bool PrinceEngine::loadTrans(byte *transTable, const char *resourceName) {
|
||||||
Common::SeekableReadStream *stream = SearchMan.createReadStreamForMember(resourceName);
|
Common::SeekableReadStream *stream = SearchMan.createReadStreamForMember(resourceName);
|
||||||
if (!stream) {
|
if (!stream) {
|
||||||
delete stream;
|
|
||||||
for (int i = 0; i < 256; i++) {
|
for (int i = 0; i < 256; i++) {
|
||||||
for (int j = 0; j < 256; j++) {
|
for (int j = 0; j < 256; j++) {
|
||||||
transTable[i * 256 + j] = j;
|
transTable[i * 256 + j] = j;
|
||||||
@ -303,7 +299,6 @@ bool PrinceEngine::loadTrans(byte *transTable, const char *resourceName) {
|
|||||||
bool PrinceEngine::loadPath(const char *resourceName) {
|
bool PrinceEngine::loadPath(const char *resourceName) {
|
||||||
Common::SeekableReadStream *stream = SearchMan.createReadStreamForMember(resourceName);
|
Common::SeekableReadStream *stream = SearchMan.createReadStreamForMember(resourceName);
|
||||||
if (!stream) {
|
if (!stream) {
|
||||||
delete stream;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -324,7 +319,6 @@ bool PrinceEngine::loadAllInv() {
|
|||||||
const Common::Path invStreamName(Common::String::format("INV%02d", i));
|
const Common::Path invStreamName(Common::String::format("INV%02d", i));
|
||||||
Common::SeekableReadStream *invStream = SearchMan.createReadStreamForMember(invStreamName);
|
Common::SeekableReadStream *invStream = SearchMan.createReadStreamForMember(invStreamName);
|
||||||
if (!invStream) {
|
if (!invStream) {
|
||||||
delete invStream;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -351,7 +345,6 @@ bool PrinceEngine::loadAllInv() {
|
|||||||
bool PrinceEngine::loadMobPriority(const char *resourceName) {
|
bool PrinceEngine::loadMobPriority(const char *resourceName) {
|
||||||
Common::SeekableReadStream *stream = SearchMan.createReadStreamForMember(resourceName);
|
Common::SeekableReadStream *stream = SearchMan.createReadStreamForMember(resourceName);
|
||||||
if (!stream) {
|
if (!stream) {
|
||||||
delete stream;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -388,7 +388,6 @@ bool Script::loadAllMasks(Common::Array<Mask> &maskList, int offset) {
|
|||||||
tempMask._height = 0;
|
tempMask._height = 0;
|
||||||
tempMask._data = nullptr;
|
tempMask._data = nullptr;
|
||||||
warning("loadAllMasks: Can't load %s", msStreamName.toString().c_str());
|
warning("loadAllMasks: Can't load %s", msStreamName.toString().c_str());
|
||||||
delete msStream;
|
|
||||||
} else {
|
} else {
|
||||||
msStream = Resource::getDecompressedStream(msStream);
|
msStream = Resource::getDecompressedStream(msStream);
|
||||||
|
|
||||||
|
@ -81,7 +81,6 @@ bool PrinceEngine::loadSample(uint32 sampleSlot, const Common::String &streamNam
|
|||||||
freeSample(sampleSlot);
|
freeSample(sampleSlot);
|
||||||
Common::SeekableReadStream *sampleStream = SearchMan.createReadStreamForMember(Common::Path(normalizedPath));
|
Common::SeekableReadStream *sampleStream = SearchMan.createReadStreamForMember(Common::Path(normalizedPath));
|
||||||
if (sampleStream == nullptr) {
|
if (sampleStream == nullptr) {
|
||||||
delete sampleStream;
|
|
||||||
error("Can't load sample %s to slot %d", normalizedPath.c_str(), sampleSlot);
|
error("Can't load sample %s to slot %d", normalizedPath.c_str(), sampleSlot);
|
||||||
}
|
}
|
||||||
_audioStream[sampleSlot] = Audio::makeWAVStream(sampleStream->readStream(sampleStream->size()), DisposeAfterUse::YES);
|
_audioStream[sampleSlot] = Audio::makeWAVStream(sampleStream->readStream(sampleStream->size()), DisposeAfterUse::YES);
|
||||||
|
Loading…
Reference in New Issue
Block a user