]> granicus.if.org Git - postgis/commitdiff
#2969, memory leak in the function of "lwtriangle_from_wkb_state"
authorPaul Ramsey <pramsey@cleverelephant.ca>
Tue, 17 Mar 2015 16:30:33 +0000 (16:30 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Tue, 17 Mar 2015 16:30:33 +0000 (16:30 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@13353 b70326c6-7e19-0410-871a-916f4a2858ee

liblwgeom/lwin_wkb.c

index cfd887f03c1aaf44f5a196e203f026e4f6327463..5a90520d68c96b01170ab3e47ab56381a3b97e11 100644 (file)
@@ -557,6 +557,10 @@ static LWTRIANGLE* lwtriangle_from_wkb_state(wkb_parse_state *s)
                return NULL;
        }
 
+       /* Empty TRIANGLE starts w/ empty POINTARRAY, free it first */
+       if (tri->points)
+               ptarray_free(tri->points);
+       
        tri->points = pa;       
        return tri;
 }