Fix leaks in sceMpeg demuxing.

This commit is contained in:
Unknown W. Brackets 2014-03-30 13:06:42 -07:00
parent 917af7b571
commit ea9a6c1b58
3 changed files with 8 additions and 2 deletions

View File

@ -470,6 +470,11 @@ u32 sceMpegCreate(u32 mpegAddr, u32 dataPtr, u32 size, u32 ringbufferAddr, u32 f
Memory::Write_U32(ringbuffer->dataUpperBound, mpegHandle + 20);
}
MpegContext *ctx = new MpegContext;
if (mpegMap.find(mpegHandle) != mpegMap.end()) {
WARN_LOG_REPORT(HLE, "Replacing existing mpeg context at %08x", mpegAddr);
// Otherwise, it would leak.
delete mpegMap[mpegHandle];
}
mpegMap[mpegHandle] = ctx;
// Initialize mpeg values.

View File

@ -27,7 +27,8 @@ MpegDemux::MpegDemux(int size, int offset) : m_audioStream(size) {
m_readSize = 0;
}
MpegDemux::~MpegDemux(void) {
MpegDemux::~MpegDemux() {
delete [] m_buf;
}
void MpegDemux::DoState(PointerWrap &p) {

View File

@ -12,7 +12,7 @@ class MpegDemux
{
public:
MpegDemux(int size, int offset);
~MpegDemux(void);
~MpegDemux();
bool addStreamData(u8* buf, int addSize);
void demux(int audioChannel);