Skip to content
Permalink
Browse files
Fix memory corruption in msGEOSGetCentroid (#6041)
  • Loading branch information
github-actions[bot] committed Apr 9, 2020
1 parent 15d9366 commit a5af7f74006516b78907123f889d122e3c906257
Showing 1 changed file with 2 additions and 1 deletion.
@@ -943,6 +943,7 @@ pointObj *msGEOSGetCentroid(shapeObj *shape)
if(!g1) return NULL;

g2 = GEOSGetCentroid_r(handle,g1);
if (!g2) return NULL;

point = (pointObj *) malloc(sizeof(pointObj));

@@ -952,7 +953,7 @@ pointObj *msGEOSGetCentroid(shapeObj *shape)
GEOSCoordSeq_getY_r(handle,coords, 0, &(point->y));
/* GEOSCoordSeq_getZ(coords, 0, &(point->z)); */

GEOSCoordSeq_destroy_r(handle,coords);
GEOSGeom_destroy_r(handle, g2);

return point;
#else

0 comments on commit a5af7f7

Please sign in to comment.