From 29e1f1e9cea0d2e8a34df2cd049b105ee2942f02 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Sun, 1 Oct 2017 09:02:11 -0700 Subject: [PATCH] Avoid deleting object of different size than what was allocated --- src/unix/fswatcher_inotify.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/unix/fswatcher_inotify.cpp b/src/unix/fswatcher_inotify.cpp index bc97f18a74..a5be172e5e 100644 --- a/src/unix/fswatcher_inotify.cpp +++ b/src/unix/fswatcher_inotify.cpp @@ -432,7 +432,7 @@ protected: if ( it2 == m_cookies.end() ) { int size = sizeof(inevt) + inevt.len; - inotify_event* e = (inotify_event*) operator new (size); + inotify_event* e = (inotify_event*)new char[size]; memcpy(e, &inevt, size); wxInotifyCookies::value_type val(e->cookie, e); @@ -481,7 +481,7 @@ protected: } m_cookies.erase(it2); - delete &oldinevt; + delete[] (char*)&oldinevt; } } // every other kind of event