Free correctly in C wrapper.