<div dir="ltr"><div><br><br>On Thu, Sep 28, 2017 at 7:56 PM, Even Rouault <<a href="mailto:even.rouault@spatialys.com">even.rouault@spatialys.com</a>> wrote:<br>><br>> > As of trunk r71513, v.in.ogr converts any curve types to linear equivalents<br>><br>> > with OGR_G_GetLinearGeometry().<br>><br>>  <br>><br>> r71513 is going to leak memory. The return of OGR_G_GetLinearGeometry() must be freed with OGR_G_DestroyGeometry()<br><br></div>I must have missed that "The ownership of the returned geometry belongs to the caller."<div><div><div><br></div><div><div>In contrast, with OGR_G_ForceTo() "a new [geometry is] returned (or potentially the same one)", therefore OGR_G_GetLinearGeometry() is easier to use.<br></div><br>><br>> (be careful to call it only on a Ogr_geometry returned by OGR_G_GetLinearGeometry() and not the one returned by OGR_F_GetGeometryRef())<br></div><div><br></div><div>OK, done in trunk r71514.</div><div><br></div><div>By now, v.in.ogr is peppered with #if GDAL_VERSION_NUM >= X, looks like at some stage we should have two versions, one for GDAL 1.x, another one for GDAL 2.x...<br></div></div><div><br></div><div>Markus M<br></div><div><div>> --<br>><br>> Spatialys - Geospatial professional services<br>><br>> <a href="http://www.spatialys.com">http://www.spatialys.com</a><br><br></div></div></div></div>