Ok, first of all you don't need to use ugly things like malloc, this is C++ and we support the "new" operator obviously. So:
a = (float*) malloc(nsamps*sizeof(float));
could be just
a = new float[nsamps];
It's not the problem here, just looks horrible. And add destructor for your patch to clean things.
You should probably comment out most of the code and see at which point it starts to fail. Or try less bands, I don't know how much load current code generates, but Bela has a way more powerful CPU.
If you have missed this, it's possible to build native patches now - so you might be able to use that for troubleshooting, maybe even debugging will work.
Last suggestion is to become Martin - his patches don't have any bugs apparently (he said that, really).