From 17188fb2b1f05d8bdee44fc9d5bc339da3e78912 Mon Sep 17 00:00:00 2001 From: Hirotoshi YOSHITAKA Date: Mon, 6 Oct 2014 23:54:11 +0900 Subject: [PATCH] Fix calloc-free mismatch Use free() for allocated memory by calloc (not delete). Deleting calloc-ed memory will become problem in the environment which overrides global "operator delete" like some game engine. --- RtAudio.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RtAudio.cpp b/RtAudio.cpp index af7d205..9e1f1ba 100644 --- a/RtAudio.cpp +++ b/RtAudio.cpp @@ -3630,12 +3630,12 @@ public: outIndex_( 0 ) {} ~WasapiBuffer() { - delete buffer_; + free( buffer_ ); } // sets the length of the internal ring buffer void setBufferSize( unsigned int bufferSize, unsigned int formatBytes ) { - delete buffer_; + free( buffer_ ); buffer_ = ( char* ) calloc( bufferSize, formatBytes );