Fix tiny memory leak.
Fix out of bounds when resetting envelopes
FIx too small samples in test module.
[test] Add cleanup code to all tests
Fix out of bounds array access
[test] Fix sample size