diff --git a/include/NotePlayHandle.h b/include/NotePlayHandle.h index 4969fd84a63..6ad2bf04e0e 100644 --- a/include/NotePlayHandle.h +++ b/include/NotePlayHandle.h @@ -353,6 +353,7 @@ class NotePlayHandleManager static void release( NotePlayHandle * nph ); static void extend( int i ); static void free(); + static void freeAvailable(); private: static NotePlayHandle ** s_available; diff --git a/src/core/NotePlayHandle.cpp b/src/core/NotePlayHandle.cpp index 06d584a149b..5465ee95fe4 100644 --- a/src/core/NotePlayHandle.cpp +++ b/src/core/NotePlayHandle.cpp @@ -650,7 +650,7 @@ void NotePlayHandleManager::extend( int c ) { s_size += c; auto tmp = MM_ALLOC(s_size); - MM_FREE( s_available ); + freeAvailable(); s_available = tmp; auto n = MM_ALLOC(c); @@ -662,10 +662,18 @@ void NotePlayHandleManager::extend( int c ) } } -void NotePlayHandleManager::free() +void NotePlayHandleManager::freeAvailable() { + // rpmalloc catches this as a non-free'd alloc + NotePlayHandle * n = s_available[0]; + MM_FREE(n); MM_FREE(s_available); } +void NotePlayHandleManager::free() +{ + freeAvailable(); +} + } // namespace lmms \ No newline at end of file