Fix memory leak in lw_dist2d_poly_curvepoly and lw_dist2d_circstring_poly

Also clear the memory management for lwcurvepoly_construct_from_lwpoly .
Fixes #2949.

git-svn-id: http://svn.osgeo.org/postgis/branches/2.1@13022 b70326c6-7e19-0410-871a-916f4a2858ee
Fix leaks in lwcurvepoly_segmentize and its tester

git-svn-id: http://svn.osgeo.org/postgis/branches/2.1@13024 b70326c6-7e19-0410-871a-916f4a2858ee