Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/NotePlayHandle.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 10 additions & 2 deletions src/core/NotePlayHandle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ void NotePlayHandleManager::extend( int c )
{
s_size += c;
auto tmp = MM_ALLOC<NotePlayHandle*>(s_size);
MM_FREE( s_available );
freeAvailable();
s_available = tmp;

auto n = MM_ALLOC<NotePlayHandle>(c);
Expand All @@ -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