Opened 19 years ago

Closed 14 years ago

#850 closed defect (fixed)

GDALClose crash with ECW and MrSDI files.

Reported by: xpaytubi@… Owned by: warmerdam
Priority: high Milestone:
Component: GDAL_Raster Version: unspecified
Severity: normal Keywords: ecw
Cc: Mateusz Łoskot

Description (last modified by Mateusz Łoskot)

Hi,

I'm using a gdal cvs checkout from last week, the last ECW sources and MrSID libraries. I've compiled the gdal and ecw library with /MDd option.

Description:

  • When I try to close a ecw or mrsid file, GDALClose function crashes.

Reproduction:

  • The call is like : GDALClose(theDataset); theDataSet is a GDALDatasetH pointer.

Causes:

  • ECW case: When GDALClose calls "delete poDS;" this calls the ECWDataset destructor. In this method, the "delete poFileView;" call crash.

If I comment the next piece of code:

   //    if( poFileView != NULL )
   //    {
   //        poUnderlyingIOStream = ((VSIIOStream* (poFileView->GetStream()));
   //        delete poFileView;
   //    }

not crash but there are memory leaks, of course, :-)

  • MrSID case: When GDALClose calls "delete poDS;" this calls the MrSIDDataset destructor. In this method, various deletes crashes:
        if ( poImageReader && !bIsOverview )
            delete poImageReader;
        .............
        if ( poMetadata )
            delete poMetadata;
        .............
        if ( papoOverviewDS )
        {
            for( int i = 0; i < nOverviewCount; i++ )
                delete papoOverviewDS[i];
            CPLFree( papoOverviewDS );
        }
    

and also crash in MrSIDRasterBand destructor:

    if ( poPixel )
        delete poPixel;

If I comment all those lines all works correctly but also there are memory leaks like the case of ecw.

Thanks a lot.

Change History (5)

comment:1 by warmerdam, 19 years ago

Xavi, 

I have had reports from ESRI of a similar problem with the MrSID driver.
However, when they upgraded to the latest MrSID SDK from Lizardtech it
was resolved.  Perhaps you could try upgrading? 

Also, what version of the ECW SDK are/were you using.  

comment:2 by xpaytubi@…, 19 years ago

Frank,

I've upgraded my MrSID libraries and gdal driver from cvs and the crash
continues. I've could test the next cases:
1.- If I compile gdal with /MDd option and my app with /MDd or /MD, my
application crashes as I described in bug report.
2.- If I compile gdal with /MD option and my app with /MDd then appears a assert
of delete operation. And if my application has the /MD option then goes correctly.

The solution seems gdal and app with /MD option, but my application needs the
/MDd option, it calls CrtDbgReport function, :-(. And, as I reported, I've
compiled ecw with /MDd and also crashes.

Libraries versions:
1.- GDAL: From cvs on 18/05/2005
2.- MrSID: Geo_DSDK-5.0.6.955.win32.zip
3.- ECW: NCSSource_3-1_RC2.zip

Thanks a lot and I hope I've explain myself.

comment:3 by warmerdam, 19 years ago

I'm sorry, I'm afraid I am not sure where to go from here.  I am not sure
if there are issues with /MD and /MDd DLLs using different heaps. 

comment:4 by Mateusz Łoskot, 16 years ago

Cc: Mateusz Łoskot added
Description: modified (diff)
Keywords: ecw added

comment:5 by Even Rouault, 14 years ago

Resolution: fixed
Status: assignedclosed

This is outdated now I guess. I'm not aware of any current issues related to closing ECW or MrSID files

Note: See TracTickets for help on using tickets.