From 39c5cd4f84f64ffa2318489068a4273ed124dad2 Mon Sep 17 00:00:00 2001 From: Jonathan Li Date: Sun, 13 Sep 2015 23:20:26 +0100 Subject: [PATCH] pcsx2:cdvd: Fix memleak CID 146832 (#4-1 of 6): Non-array delete for scalars (DELETE_ARRAY) ScopedPtr is for non-array objects only. Use ScopedArray instead. --- pcsx2/CDVD/BlockdumpFileReader.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pcsx2/CDVD/BlockdumpFileReader.cpp b/pcsx2/CDVD/BlockdumpFileReader.cpp index 3063c51b71..6720d5535a 100644 --- a/pcsx2/CDVD/BlockdumpFileReader.cpp +++ b/pcsx2/CDVD/BlockdumpFileReader.cpp @@ -85,20 +85,19 @@ bool BlockdumpFileReader::Open(const wxString& fileName) m_file->SeekI(BlockDumpHeaderSize); - ScopedPtr buffer; u32 bs = 1024*1024; u32 off = 0; u32 has = 0; int i = 0; - buffer = new u8[bs]; + ScopedArray buffer(bs); do { - m_file->Read(buffer, bs); + m_file->Read(buffer.GetPtr(), bs); has = m_file->LastRead(); while (i < m_dtablesize && off < has) { - m_dtable[i++] = *(u32*)(buffer + off); + m_dtable[i++] = *(u32*)(buffer.GetPtr() + off); off += 4; off += m_blocksize; }