Fix missing malloc, and test for such