mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-21 03:31:40 +00:00
VIDEO: PACo decoder: Fix coverity issues
Remove unused integer _frameDelay: Fixes COVERITY: 1476344 Initialize Non-static class members on PacoDecoder: Fixes COVERITY: 1476353 Resource leak in object No destructor on PacoAudioTrack: Fixes COVERITY: 1476360 Fix memory leak in handleFrame. Delete copied data in fdata.
This commit is contained in:
parent
9424d4b4ed
commit
5bf1cc00ff
@ -49,13 +49,23 @@ enum frameTypes {
|
||||
EOC = 11 // - end of chunk marker
|
||||
};
|
||||
|
||||
PacoDecoder::PacoDecoder() {
|
||||
PacoDecoder::PacoDecoder()
|
||||
: _fileStream(nullptr), _videoTrack(nullptr), _audioTrack(nullptr) {
|
||||
}
|
||||
|
||||
PacoDecoder::~PacoDecoder() {
|
||||
close();
|
||||
}
|
||||
|
||||
void PacoDecoder::PacoDecoder::close() {
|
||||
Video::VideoDecoder::close();
|
||||
|
||||
delete _fileStream;
|
||||
_fileStream = nullptr;
|
||||
_videoTrack = nullptr;
|
||||
_audioTrack = nullptr;
|
||||
}
|
||||
|
||||
bool PacoDecoder::loadStream(Common::SeekableReadStream *stream) {
|
||||
close();
|
||||
|
||||
@ -549,6 +559,7 @@ void PacoDecoder::PacoVideoTrack::handleFrame(Common::SeekableReadStream *fileSt
|
||||
|
||||
_dirtyRects.clear();
|
||||
_dirtyRects.push_back(Common::Rect(x, y, x + bw, y + bh));
|
||||
delete[] fdata;
|
||||
}
|
||||
|
||||
void PacoDecoder::PacoVideoTrack::copyDirtyRectsToBuffer(uint8 *dst, uint pitch) {
|
||||
@ -568,6 +579,10 @@ PacoDecoder::PacoAudioTrack::PacoAudioTrack(int samplingRate)
|
||||
_packetStream = Audio::makePacketizedRawStream(samplingRate, audioFlags);
|
||||
}
|
||||
|
||||
PacoDecoder::PacoAudioTrack::~PacoAudioTrack() {
|
||||
delete _packetStream;
|
||||
}
|
||||
|
||||
void PacoDecoder::PacoAudioTrack::queueSound(Common::SeekableReadStream *fileStream, uint32 chunkSize) {
|
||||
const Common::Array<int> samplingRates = {5563, 7418, 11127, 22254};
|
||||
uint16 header = fileStream->readUint16BE();
|
||||
|
@ -48,6 +48,7 @@ class PacoDecoder : public VideoDecoder {
|
||||
public:
|
||||
PacoDecoder();
|
||||
virtual ~PacoDecoder();
|
||||
void close() override;
|
||||
|
||||
virtual bool loadStream(Common::SeekableReadStream *stream) override;
|
||||
|
||||
@ -93,7 +94,6 @@ protected:
|
||||
|
||||
int _curFrame;
|
||||
uint32 _frameCount;
|
||||
uint32 _frameDelay;
|
||||
uint16 _frameRate;
|
||||
|
||||
Common::List<Common::Rect> _dirtyRects;
|
||||
@ -102,6 +102,7 @@ protected:
|
||||
class PacoAudioTrack : public AudioTrack {
|
||||
public:
|
||||
PacoAudioTrack(int samplingRate);
|
||||
~PacoAudioTrack();
|
||||
void queueSound(Common::SeekableReadStream *fileStream, uint32 chunkSize);
|
||||
|
||||
protected:
|
||||
|
Loading…
x
Reference in New Issue
Block a user