Loading postgis/geography_centroid.c +10 −6 Original line number Diff line number Diff line Loading @@ -105,7 +105,7 @@ Datum geography_centroid(PG_FUNCTION_ARGS) /* average between all points */ uint32_t size = mpoints->ngeoms; POINT3DM points[size]; POINT3DM* points = palloc(size*sizeof(POINT3DM)); uint32_t i; for (i = 0; i < size; i++) { Loading @@ -115,6 +115,7 @@ Datum geography_centroid(PG_FUNCTION_ARGS) } lwpoint_out = geography_centroid_from_wpoints(srid, points, size); pfree(points); break; } Loading Loading @@ -258,7 +259,7 @@ LWPOINT* geography_centroid_from_mline(const LWMLINE* mline, SPHEROID* s) size += (mline->geoms[i]->points->npoints - 1) * 2; } POINT3DM points[size]; POINT3DM* points = palloc(size*sizeof(POINT3DM)); uint32_t j = 0; for (i = 0; i < mline->ngeoms; i++) { Loading Loading @@ -295,7 +296,9 @@ LWPOINT* geography_centroid_from_mline(const LWMLINE* mline, SPHEROID* s) } } return geography_centroid_from_wpoints(mline->srid, points, size); LWPOINT* result = geography_centroid_from_wpoints(mline->srid, points, size); pfree(points); return result; } Loading @@ -313,7 +316,7 @@ LWPOINT* geography_centroid_from_mpoly(const LWMPOLY* mpoly, bool use_spheroid, } } POINT3DM points[size]; POINT3DM* points = palloc(size*sizeof(POINT3DM)); uint32_t j = 0; /* use first point as reference to create triangles */ Loading Loading @@ -379,6 +382,7 @@ LWPOINT* geography_centroid_from_mpoly(const LWMPOLY* mpoly, bool use_spheroid, } } } return geography_centroid_from_wpoints(mpoly->srid, points, size); LWPOINT* result = geography_centroid_from_wpoints(mpoly->srid, points, size); pfree(points); return result; } Loading
postgis/geography_centroid.c +10 −6 Original line number Diff line number Diff line Loading @@ -105,7 +105,7 @@ Datum geography_centroid(PG_FUNCTION_ARGS) /* average between all points */ uint32_t size = mpoints->ngeoms; POINT3DM points[size]; POINT3DM* points = palloc(size*sizeof(POINT3DM)); uint32_t i; for (i = 0; i < size; i++) { Loading @@ -115,6 +115,7 @@ Datum geography_centroid(PG_FUNCTION_ARGS) } lwpoint_out = geography_centroid_from_wpoints(srid, points, size); pfree(points); break; } Loading Loading @@ -258,7 +259,7 @@ LWPOINT* geography_centroid_from_mline(const LWMLINE* mline, SPHEROID* s) size += (mline->geoms[i]->points->npoints - 1) * 2; } POINT3DM points[size]; POINT3DM* points = palloc(size*sizeof(POINT3DM)); uint32_t j = 0; for (i = 0; i < mline->ngeoms; i++) { Loading Loading @@ -295,7 +296,9 @@ LWPOINT* geography_centroid_from_mline(const LWMLINE* mline, SPHEROID* s) } } return geography_centroid_from_wpoints(mline->srid, points, size); LWPOINT* result = geography_centroid_from_wpoints(mline->srid, points, size); pfree(points); return result; } Loading @@ -313,7 +316,7 @@ LWPOINT* geography_centroid_from_mpoly(const LWMPOLY* mpoly, bool use_spheroid, } } POINT3DM points[size]; POINT3DM* points = palloc(size*sizeof(POINT3DM)); uint32_t j = 0; /* use first point as reference to create triangles */ Loading Loading @@ -379,6 +382,7 @@ LWPOINT* geography_centroid_from_mpoly(const LWMPOLY* mpoly, bool use_spheroid, } } } return geography_centroid_from_wpoints(mpoly->srid, points, size); LWPOINT* result = geography_centroid_from_wpoints(mpoly->srid, points, size); pfree(points); return result; }