Skip to content

Commit 82a22f0

Browse files
committedSep 28, 2012
The return value of CPLGetConfigOption() is volatile, and can be
invalidated by a following call to CPLSetConfigOption(). Thus it needs to be duplicated.
1 parent 40b60bb commit 82a22f0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed
 

‎src/providers/gdal/qgsgdalprovider.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1377,7 +1377,7 @@ QString QgsGdalProvider::buildPyramids( QList<QgsRasterPyramid> const & theRaste
13771377
}
13781378

13791379
// are we using Erdas Imagine external overviews?
1380-
const char* myConfigUseRRD = CPLGetConfigOption( "USE_RRD", "NO" );
1380+
char* myConfigUseRRD = strdup(CPLGetConfigOption( "USE_RRD", "NO" ));
13811381
if ( theFormat == PyramidsErdas )
13821382
CPLSetConfigOption( "USE_RRD", "YES" );
13831383
else
@@ -1471,6 +1471,7 @@ QString QgsGdalProvider::buildPyramids( QList<QgsRasterPyramid> const & theRaste
14711471
//emit drawingProgress( 0, 0 );
14721472
// restore former USE_RRD config (Erdas)
14731473
CPLSetConfigOption( "USE_RRD", myConfigUseRRD );
1474+
free(myConfigUseRRD);
14741475
return "FAILED_NOT_SUPPORTED";
14751476
}
14761477
else
@@ -1487,6 +1488,7 @@ QString QgsGdalProvider::buildPyramids( QList<QgsRasterPyramid> const & theRaste
14871488

14881489
// restore former USE_RRD config (Erdas)
14891490
CPLSetConfigOption( "USE_RRD", myConfigUseRRD );
1491+
free(myConfigUseRRD);
14901492

14911493
QgsDebugMsg( "Pyramid overviews built" );
14921494

0 commit comments

Comments
 (0)
Please sign in to comment.