PETKA: Prefer copy over resource leak.

Fixes CID 1429046, 1433642, 1428846, 1429047, 1433123, 1433641,
1428973, 1429049, 1428856, 1428867, 1428869, 1429039, 1428850,
1433640
This commit is contained in:
Eugene Sandulenko 2022-10-24 10:38:19 +02:00
parent 0e60adfa58
commit d56f1ea53c
No known key found for this signature in database
GPG Key ID: 014D387312D34F08
2 changed files with 10 additions and 10 deletions

View File

@ -65,20 +65,20 @@ void FlicDecoder::load(Common::SeekableReadStream *stream, Common::SeekableReadS
delete mskStream;
}
const Common::Rect &FlicDecoder::getBounds() const {
const Common::Rect FlicDecoder::getBounds() const {
const Track *track = getTrack(0);
if (track)
return ((const FlicVideoTrack *)track)->getBounds();
return *(new Common::Rect(0, 0));
return Common::Rect(0, 0);
}
const Common::Array<Common::Rect> &FlicDecoder::getMskRects() const {
const Common::Array<Common::Rect> FlicDecoder::getMskRects() const {
const Track *track = getTrack(0);
if (track)
return ((const FlicVideoTrack *)track)->getMskRects();
return *(new Common::Array<Common::Rect>());
return Common::Array<Common::Rect>();
}
uint32 FlicDecoder::getTransColor(const Graphics::PixelFormat &fmt) const {
@ -160,7 +160,7 @@ bool FlicDecoder::FlicVideoTrack::loadMsk(Common::SeekableReadStream &stream) {
return true;
}
const Common::Rect &FlicDecoder::FlicVideoTrack::getBounds() const {
const Common::Rect FlicDecoder::FlicVideoTrack::getBounds() const {
return _bounds;
}
@ -168,7 +168,7 @@ const Graphics::Surface *FlicDecoder::FlicVideoTrack::getSurface() const {
return _surface;
}
const Common::Array<Common::Rect> &FlicDecoder::FlicVideoTrack::getMskRects() const {
const Common::Array<Common::Rect> FlicDecoder::FlicVideoTrack::getMskRects() const {
assert(_curFrame >= 0);
return _msk[_curFrame];
}

View File

@ -33,8 +33,8 @@ public:
void setFrame(int frame);
uint getDelay() const;
const Common::Rect &getBounds() const;
const Common::Array<Common::Rect> &getMskRects() const;
const Common::Rect getBounds() const;
const Common::Array<Common::Rect> getMskRects() const;
const Graphics::Surface *getCurrentFrame() const;
uint32 getTransColor(const Graphics::PixelFormat &fmt) const;
@ -48,8 +48,8 @@ protected:
bool loadMsk(Common::SeekableReadStream &stream);
uint getDelay() const;
const Common::Rect &getBounds() const;
const Common::Array<Common::Rect> &getMskRects() const;
const Common::Rect getBounds() const;
const Common::Array<Common::Rect> getMskRects() const;
const Graphics::Surface *getSurface() const;
private: