From 11959a378169eec95f868b346ddc9ac72cb92689 Mon Sep 17 00:00:00 2001 From: Timo Wiren Date: Sat, 24 Mar 2012 19:41:13 +0200 Subject: [PATCH 1/2] Matching new and delete. --- Source/Core/Core/Src/HW/WiimoteEmu/EmuSubroutines.cpp | 1 + Source/Core/Core/Src/Movie.cpp | 6 +++--- Source/Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Source/Core/Core/Src/HW/WiimoteEmu/EmuSubroutines.cpp b/Source/Core/Core/Src/HW/WiimoteEmu/EmuSubroutines.cpp index 6b6519d7b2..7acf1a962d 100644 --- a/Source/Core/Core/Src/HW/WiimoteEmu/EmuSubroutines.cpp +++ b/Source/Core/Core/Src/HW/WiimoteEmu/EmuSubroutines.cpp @@ -427,6 +427,7 @@ void Wiimote::ReadData(const wm_read_data* const rd) if (address + size > WIIMOTE_EEPROM_SIZE) { PanicAlert("ReadData: address + size out of bounds"); + delete [] block; return; } // generate a read error diff --git a/Source/Core/Core/Src/Movie.cpp b/Source/Core/Core/Src/Movie.cpp index 9c2fb02d64..8777976776 100644 --- a/Source/Core/Core/Src/Movie.cpp +++ b/Source/Core/Core/Src/Movie.cpp @@ -304,7 +304,7 @@ bool BeginRecordingInput(int controllers) g_rerecords = 0; g_playMode = MODE_RECORDING; - delete tmpInput; + delete [] tmpInput; tmpInput = new u8[MAX_DTM_LENGTH]; g_currentByte = g_totalBytes = 0; @@ -653,7 +653,7 @@ void LoadInput(const char *filename) g_totalInputCount = tmpHeader.inputCount; g_totalBytes = totalSavedBytes; - delete tmpInput; + delete [] tmpInput; tmpInput = new u8[MAX_DTM_LENGTH]; t_record.ReadArray(tmpInput, (size_t)g_totalBytes); } @@ -707,7 +707,7 @@ void LoadInput(const char *filename) break; } } - delete movInput; + delete [] movInput; } } t_record.Close(); diff --git a/Source/Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp b/Source/Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp index 0f4809a6cc..8aabf2a066 100644 --- a/Source/Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp +++ b/Source/Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp @@ -143,8 +143,8 @@ void TexDecoder_OpenCL_Initialize() } } } - delete header; - delete binary; + delete [] header; + delete [] binary; } // If an error occurred using the kernel binary, recompile the kernels From cb92805445856e372ccbd156b4c11740525d8e55 Mon Sep 17 00:00:00 2001 From: Timo Wiren Date: Sun, 25 Mar 2012 13:01:26 +0300 Subject: [PATCH 2/2] Spaces to tabs. Removed a comment. --- Source/Core/Core/Src/HW/WiimoteEmu/EmuSubroutines.cpp | 2 +- Source/Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/Src/HW/WiimoteEmu/EmuSubroutines.cpp b/Source/Core/Core/Src/HW/WiimoteEmu/EmuSubroutines.cpp index 7acf1a962d..e7036c8fcb 100644 --- a/Source/Core/Core/Src/HW/WiimoteEmu/EmuSubroutines.cpp +++ b/Source/Core/Core/Src/HW/WiimoteEmu/EmuSubroutines.cpp @@ -427,7 +427,7 @@ void Wiimote::ReadData(const wm_read_data* const rd) if (address + size > WIIMOTE_EEPROM_SIZE) { PanicAlert("ReadData: address + size out of bounds"); - delete [] block; + delete [] block; return; } // generate a read error diff --git a/Source/Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp b/Source/Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp index 8aabf2a066..440e69efd6 100644 --- a/Source/Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp +++ b/Source/Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp @@ -114,7 +114,7 @@ void TexDecoder_OpenCL_Initialize() else { binary_size = input.GetSize(); - header = new char[HEADER_SIZE]; // TODO: memleak possible + header = new char[HEADER_SIZE]; binary = new char[binary_size]; input.ReadBytes(header, HEADER_SIZE); input.ReadBytes(binary, binary_size);