Skip to content
Permalink
Browse files

Merge pull request #2940 from rouault/spatialite_bind_blob_fix

[Spatialite] Use correct free function for sqlite3_bind_blob of geome…
  • Loading branch information
jef-n committed Mar 23, 2016
2 parents 70e2696 + 2e04162 commit 9767bd054a0ac9a297eeca61f9f3f5e7c1a421cb
Showing with 7 additions and 2 deletions.
  1. +7 −2 src/providers/spatialite/qgsspatialiteprovider.cpp
@@ -3594,6 +3594,11 @@ QString QgsSpatiaLiteProvider::geomParam() const
return geometry;
}

static void deleteWkbBlob( void* wkbBlob )
{
delete[]( char* )wkbBlob;
}

bool QgsSpatiaLiteProvider::addFeatures( QgsFeatureList & flist )
{
sqlite3_stmt *stmt = nullptr;
@@ -3677,7 +3682,7 @@ bool QgsSpatiaLiteProvider::addFeatures( QgsFeatureList & flist )
if ( !wkb )
sqlite3_bind_null( stmt, ++ia );
else
sqlite3_bind_blob( stmt, ++ia, wkb, wkb_size, free );
sqlite3_bind_blob( stmt, ++ia, wkb, wkb_size, deleteWkbBlob );
}
}

@@ -4070,7 +4075,7 @@ bool QgsSpatiaLiteProvider::changeGeometryValues( const QgsGeometryMap &geometry
if ( !wkb )
sqlite3_bind_null( stmt, 1 );
else
sqlite3_bind_blob( stmt, 1, wkb, wkb_size, free );
sqlite3_bind_blob( stmt, 1, wkb, wkb_size, deleteWkbBlob );
sqlite3_bind_int64( stmt, 2, FID_TO_NUMBER( iter.key() ) );

// performing actual row update

0 comments on commit 9767bd0

Please sign in to comment.
You can’t perform that action at this time.