In splitConvexPolygon memory is allocated as REAL poly1[100], but it gets returned as a pointer to the calling function halfPlaneIntersection. This is invalid, since the (stack) memory will be released as soon as the function returns.
Use malloc in halfPlaneIntersection and free it properly.
In
splitConvexPolygon
memory is allocated asREAL poly1[100]
, but it gets returned as a pointer to the calling functionhalfPlaneIntersection
. This is invalid, since the (stack) memory will be released as soon as the function returns.Use
malloc
inhalfPlaneIntersection
and free it properly.