Free(): invalid next size (normal) with ported cpp code

It’s hard to say.
The way I would debug this is remove pieces of the code until it works fine. And then add them back one by one. Until you find the one thing that makes it fail :slight_smile: