Replace uses of variable-length arrays with try_malloc()/free().