[Gdal-dev] Memory Leak? OGRGeometryFactory::forcetoMultiPolygon
Frank Warmerdam
warmerdam at pobox.com
Mon Nov 13 12:57:12 EST 2006
Craig Miller wrote:
> Is there any cleanup code necessary when working with
> OGRGeometryFactory::forceToMultiPolygon?
>
> The following snippit appears to cause a leak:
> pDstFeature->SetGeometryDirectly(
> OGRGeometryFactory::forceToMultiLineString(pDstFeature->StealGeometry()));
>
> And just to verify that it wasn't the StealGeometry/SetGeometryDirectly
> portion I verified that replacing the above code with this does not leak:
> pDstFeature->SetGeometryDirectly( pDstFeature->StealGeometry());
Craig,
I have reviewed the code, and it appears that there is a memory leak when
the input is a simple OGRLineString. I have applied the following patch
in CVS.
@@ -809,7 +806,7 @@
return poGeom;
OGRMultiLineString *poMP = new OGRMultiLineString();
- poMP->addGeometryDirectly( poGeom );
+ poMP->addGeometry( poGeom );
return poMP;
}
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | President OSGeo, http://osgeo.org
More information about the Gdal-dev
mailing list