Skip to content

Commit

Permalink
Merge pull request #2940 from rouault/spatialite_bind_blob_fix
Browse files Browse the repository at this point in the history
[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 9767bd0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/providers/spatialite/qgsspatialiteprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 );
}
}

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9767bd0

Please sign in to comment.