Opened 18 years ago

Closed 18 years ago

#16 closed defect (fixed)

Serious reference leak with raster properties

Reported by: warmerdam Owned by: warmerdam
Priority: major Milestone: 3.3.0
Component: GDAL Provider Version: 3.2.0
Severity: 2 Keywords:
Cc: gregboone External ID:

Description

Code like the following on datasets without a palette results in the raster file(s) not getting closed on connection termination.

FdoPtr<FdoIRasterPropertyDictionary> propDict = raster->GetAuxiliaryProperties(); FdoPtr<FdoDataValue> pal = propDict->GetProperty(L"Palette");

It turns out the problem is that FdoRfpRasterPropertyDictionay::GetProperty() was getting a reference to an image with m_raster->GetImage() without ever releasing it again. In fact, I suppose this was occur for any fetch of a raster property whether it has it or not.

The problem exists in the fdogdal 3.2.0 provider and later.

The following patch fixes the problem in 3.3.0 trunk (and is committed). The same fix needs to be backpatched to the 3.2.x branch. cc:ing Greg for instructions on what branch exactly this should go into.

Index: FdoRfpRasterPropertyDictionary.cpp
===================================================================
--- FdoRfpRasterPropertyDictionary.cpp	(revision 2551)
+++ FdoRfpRasterPropertyDictionary.cpp	(working copy)
@@ -96,7 +96,7 @@
         throw FdoException::Create(FdoException::NLSGetMessage(FDO_2_BADPARAMETER, "Bad parameter to method."));
 
     FdoDataValue* rv;
-    FdoRfpImage *image = m_raster->GetImage();
+    FdoPtr<FdoRfpImage> image = m_raster->GetImage();
     GDALColorTableH hCT = GDALGetRasterColorTable( GDALGetRasterBand( image->GetDS(), image->m_bandList[0] ) );
     int numOfEntries = 0;

Change History (2)

comment:1 by warmerdam, 18 years ago

Status: newassigned

comment:2 by warmerdam, 18 years ago

Resolution: fixed
Status: assignedclosed

Patch applied in 3.2.x branch of fdogdal repository.

Note: See TracTickets for help on using tickets.