[fdo-trac] #16: Serious reference leak with raster properties

FDO trac_fdo at osgeo.org
Wed Feb 21 23:21:56 EST 2007


#16: Serious reference leak with raster properties
-----------------------------+----------------------------------------------
   Reporter:  warmerdam      |       Owner:  warmerdam
       Type:  defect         |      Status:  new      
   Priority:  major          |   Milestone:  3.3.0    
  Component:  GDAL Provider  |     Version:  3.2.0    
   Severity:  2              |    Keywords:           
External_id:                 |  
-----------------------------+----------------------------------------------
 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;
 }}}

-- 
Ticket URL: <http://trac.osgeo.org/fdo/ticket/16>
FDO <http://fdo.osgeo.org/>
Feature Data Objects


More information about the fdo-trac mailing list