Skip to content

Commit

Permalink
Fix memory leaks when interrupting overview building (equivalent of t…
Browse files Browse the repository at this point in the history
…he fix done in 1.6-esri)

git-svn-id: https://svn.osgeo.org/gdal/trunk/gdal@17078 f0d54148-0727-0410-94bb-9a71ac55c965
  • Loading branch information
rouault committed May 21, 2009
1 parent 5efb798 commit ff53211
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions gcore/overview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -990,18 +990,19 @@ GDALRegenerateOverviews( GDALRasterBandH hSrcBand,
NULL, pProgressData ) )
{
CPLError( CE_Failure, CPLE_UserInterrupt, "User terminated" );
return CE_Failure;
eErr = CE_Failure;
}

if( nFullResYChunk + nChunkYOff > poSrcBand->GetYSize() )
nFullResYChunk = poSrcBand->GetYSize() - nChunkYOff;

/* read chunk */
poSrcBand->RasterIO( GF_Read, 0, nChunkYOff, nWidth, nFullResYChunk,
if (eErr == CE_None)
eErr = poSrcBand->RasterIO( GF_Read, 0, nChunkYOff, nWidth, nFullResYChunk,
pafChunk, nWidth, nFullResYChunk, eType,
0, 0 );
if (bUseNoDataMask)
poSrcBand->GetMaskBand()->RasterIO( GF_Read, 0, nChunkYOff, nWidth, nFullResYChunk,
if (eErr == CE_None && bUseNoDataMask)
eErr = poSrcBand->GetMaskBand()->RasterIO( GF_Read, 0, nChunkYOff, nWidth, nFullResYChunk,
pabyChunkNodataMask, nWidth, nFullResYChunk, GDT_Byte,
0, 0 );

Expand Down Expand Up @@ -1053,7 +1054,7 @@ GDALRegenerateOverviews( GDALRasterBandH hSrcBand,
/* -------------------------------------------------------------------- */
/* Renormalized overview mean / stddev if needed. */
/* -------------------------------------------------------------------- */
if( EQUAL(pszResampling,"AVERAGE_MP") )
if( eErr == CE_None && EQUAL(pszResampling,"AVERAGE_MP") )
{
GDALOverviewMagnitudeCorrection( (GDALRasterBandH) poSrcBand,
nOverviewCount,
Expand Down Expand Up @@ -1321,7 +1322,7 @@ GDALRegenerateOverviewsMultiBand(int nBands, GDALRasterBand** papoSrcBands,
NULL, pProgressData ) )
{
CPLError( CE_Failure, CPLE_UserInterrupt, "User terminated" );
return CE_Failure;
eErr = CE_Failure;
}

int nChunkXOff;
Expand Down

0 comments on commit ff53211

Please sign in to comment.