]> granicus.if.org Git - postgis/commitdiff
Memory leak in lwline_from_wkb_state
authorRegina Obe <lr@pcorp.us>
Sun, 9 Jul 2017 14:14:18 +0000 (14:14 +0000)
committerRegina Obe <lr@pcorp.us>
Sun, 9 Jul 2017 14:14:18 +0000 (14:14 +0000)
References #3782 for PostGIS 2.4 (trunk)
Patch provided by Even Rouault

git-svn-id: http://svn.osgeo.org/postgis/trunk@15478 b70326c6-7e19-0410-871a-916f4a2858ee

liblwgeom/lwin_wkb.c

index 35539dc8e63d15e559467a1d3f3f3fb78eb3ad1b..4cac75357ed0e17d8fa04fd119bb64a27b6baa6f 100644 (file)
@@ -441,7 +441,10 @@ static LWLINE* lwline_from_wkb_state(wkb_parse_state *s)
        POINTARRAY *pa = ptarray_from_wkb_state(s);
 
        if( pa == NULL || pa->npoints == 0 )
+       {
+               ptarray_free(pa);
                return lwline_construct_empty(s->srid, s->has_z, s->has_m);
+       }
 
        if( s->check & LW_PARSER_CHECK_MINPOINTS && pa->npoints < 2 )
        {