From a3b5334921700affaf4e67718b24ad88545ee350 Mon Sep 17 00:00:00 2001 From: Quantum Date: Fri, 14 Jun 2013 19:10:01 -0400 Subject: [PATCH] I didn't know that I deleted new[] arrays with delete. Signed-off-by: Xiaomao Chen --- src/MainWindow.cpp | 2 +- src/PianoControl.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 26ac9a9..78bc7dc 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -376,7 +376,7 @@ LRESULT MainWindow::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) int size = dnslen(keychars) + 1, i; LPWSTR s; if (m_keychars) - delete m_keychars; + delete [] m_keychars; m_keychars = new WCHAR[size]; for (i = 0; i < size; ++i) { WORD scan = VkKeyScanEx(keychars[i], hklQWERTY); diff --git a/src/PianoControl.cpp b/src/PianoControl.cpp index 168d6f3..b3a7aca 100644 --- a/src/PianoControl.cpp +++ b/src/PianoControl.cpp @@ -76,7 +76,7 @@ void PianoControl::SetOctaves(int octaves) newname = new type[7 * octaves];\ if (store) {\ memcpy(newname, store, min(this->octaves * 7, 7 * octaves) * sizeof(type));\ - delete store;\ + delete [] store;\ } else \ memset(newname, 0, 7 * octaves * sizeof(type));\ store = newname;\ @@ -296,7 +296,7 @@ void PianoControl::PaintContent(PAINTSTRUCT *pps) int bufidx = 0; \ if (bufsize < bufneed) { \ if (szBuffer) \ - delete szBuffer; \ + delete [] szBuffer; \ szBuffer = new WCHAR[bufneed]; \ } \ for (LPCWSTR c = store[i]; *c; c++) { \