There were some memory leaks in the `polyline_fit_curve` and `polyline_detect_corners` functions, because the c-style arrays that the library returns are never freed. We only copy the data and return it. The fix makes sure we free the temporary arrays.