Skip to content

Commit

Permalink
Fix finalize statement and close srs.db
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed Nov 25, 2013
1 parent b756fe7 commit 392be78
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/core/qgscoordinatetransform.cpp
Expand Up @@ -857,13 +857,15 @@ void QgsCoordinateTransform::searchDatumTransform( const QString& sql, QList< in
int openResult = sqlite3_open( QgsApplication::srsDbFilePath().toUtf8().constData(), &db );
if ( openResult != SQLITE_OK )
{
sqlite3_close( db );
return;
}

sqlite3_stmt* stmt;
int prepareRes = sqlite3_prepare( db, sql.toAscii(), sql.size(), &stmt, NULL );
if ( prepareRes != SQLITE_OK )
{
sqlite3_close( db );
return;
}

Expand All @@ -885,6 +887,7 @@ QString QgsCoordinateTransform::datumTransformString( int datumTransform )
int openResult = sqlite3_open( QgsApplication::srsDbFilePath().toUtf8().constData(), &db );
if ( openResult != SQLITE_OK )
{
sqlite3_close( db );
return transformString;
}

Expand All @@ -893,6 +896,7 @@ QString QgsCoordinateTransform::datumTransformString( int datumTransform )
int prepareRes = sqlite3_prepare( db, sql.toAscii(), sql.size(), &stmt, NULL );
if ( prepareRes != SQLITE_OK )
{
sqlite3_close( db );
return transformString;
}

Expand Down Expand Up @@ -925,6 +929,8 @@ QString QgsCoordinateTransform::datumTransformString( int datumTransform )
}
}

sqlite3_finalize( stmt );
sqlite3_close( db );
return transformString;
}

Expand Down

0 comments on commit 392be78

Please sign in to comment.