Skip to content

Commit c05bfb5

Browse files
author
jef
committed
fix spit plugin
git-svn-id: http://svn.osgeo.org/qgis/trunk@9168 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent cbf8dbd commit c05bfb5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/plugins/spit/qgsshapefile.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include <QApplication>
2020
#include <ogr_api.h>
21+
#include <cpl_conv.h>
2122
#include <string>
2223
#include <fstream>
2324
#include <cstdio>
@@ -406,14 +407,14 @@ bool QgsShapeFile::insertLayer( QString dbname, QString schema, QString primary_
406407
.arg( QgsPgUtil::quotedIdentifier( table_name ) )
407408
.arg( m );
408409

409-
int num = OGR_G_WkbSize( geom );
410-
char * geo_temp = new char[num*3];
410+
char *geo_temp;
411411
// 'GeometryFromText' supports only 2D coordinates
412412
// TODO for proper 2.5D support we would need to use 'GeomFromEWKT'
413413
if ( hasMoreDimensions )
414414
OGR_G_SetCoordinateDimension( geom, 2 );
415415
OGR_G_ExportToWkt( geom, &geo_temp );
416416
QString geometry( geo_temp );
417+
CPLFree(geo_temp);
417418

418419
for ( uint n = 0; n < column_types.size(); n++ )
419420
{
@@ -462,7 +463,6 @@ bool QgsShapeFile::insertLayer( QString dbname, QString schema, QString primary_
462463

463464
pro.setValue( pro.value() + 1 );
464465
qApp->processEvents();
465-
delete[] geo_temp;
466466
}
467467
OGR_F_Destroy( feat );
468468
}

0 commit comments

Comments
 (0)