From: Paul Ramsey Date: Mon, 11 Sep 2017 18:45:31 +0000 (+0000) Subject: Try and ensure clean memory into kmeans algorithm X-Git-Tag: 2.4.0rc1~14 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=eeec949f3ae2248e21f222ef334b4c32a2199362;p=postgis Try and ensure clean memory into kmeans algorithm git-svn-id: http://svn.osgeo.org/postgis/trunk@15692 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/liblwgeom/lwkmeans.c b/liblwgeom/lwkmeans.c index 7500c9464..1a37123b7 100644 --- a/liblwgeom/lwkmeans.c +++ b/liblwgeom/lwkmeans.c @@ -93,6 +93,10 @@ lwgeom_cluster_2d_kmeans(const LWGEOM **geoms, int ngeoms, int k) assert(ngeoms>0); assert(geoms); + /* Initialize our static structs */ + memset(&config, 0, sizeof(kmeans_config)); + memset(&result, 0, sizeof(kmeans_result)); + if (ngeoms