Skip to content
Permalink
Browse files

More memory leak fixes identified by Coverity

  • Loading branch information
nyalldawson committed Feb 4, 2015
1 parent b187825 commit 7e66e3348589177ea81231ca89b51d31ed69973f
@@ -427,6 +427,7 @@ void QgsOSMDatabase::exportSpatiaLiteNodes( const QString& tableName, const QStr
if ( insertRes != SQLITE_DONE )
{
mError = QString( "Error inserting node %1 [%2]" ).arg( n.id() ).arg( insertRes );
delete geom;
break;
}

@@ -498,6 +499,7 @@ void QgsOSMDatabase::exportSpatiaLiteWays( bool closed, const QString& tableName
if ( insertRes != SQLITE_DONE )
{
mError = QString( "Error inserting way %1 [%2]" ).arg( w.id() ).arg( insertRes );
delete geom;
break;
}

@@ -366,7 +366,9 @@ double QgsGeometryAnalyzer::perimeterMeasure( QgsGeometry* geometry, QgsDistance
{
for ( jt = it->begin(); jt != it->end(); ++jt )
{
value = value + measure.measure( QgsGeometry::fromPolyline( *jt ) );
QgsGeometry* geom = QgsGeometry::fromPolyline( *jt );
value = value + measure.measure( geom );
delete geom;
}
}
}
@@ -376,7 +378,9 @@ double QgsGeometryAnalyzer::perimeterMeasure( QgsGeometry* geometry, QgsDistance
QgsPolygon poly = geometry->asPolygon();
for ( jt = poly.begin(); jt != poly.end(); ++jt )
{
value = value + measure.measure( QgsGeometry::fromPolyline( *jt ) );
QgsGeometry* geom = QgsGeometry::fromPolyline( *jt );
value = value + measure.measure( geom );
delete geom;
}
}
return value;
@@ -362,6 +362,8 @@ void QgsZonalStatistics::statisticsFromPreciseIntersection( void* band, QgsGeome
}
delete intersectGeometry;
}
delete pixelRectGeometry;
pixelRectGeometry = 0;
}
currentX += cellSizeX;
}
@@ -949,6 +949,7 @@ void QgsGPSInformationWidget::on_mBtnCloseFeature_clicked()
else if ( avoidIntersectionsReturn == 3 )
{
QMessageBox::critical( 0, tr( "Error" ), tr( "An error was reported during intersection removal" ) );
delete f;
connectGpsSlot();
return;
}
@@ -959,6 +960,7 @@ void QgsGPSInformationWidget::on_mBtnCloseFeature_clicked()
QMessageBox::critical( 0, tr( "Error" ), tr( "Cannot add feature. "
"Unknown WKB type. Choose a different layer and try again." ) );
connectGpsSlot();
delete f;
return; //unknown wkbtype
} // layerWKBType == QGis::WKBPolygon

@@ -194,11 +194,15 @@ void QgsMapToolNodeTool::createTopologyRubberBands( QgsVectorLayer* vlayer, cons

int movingPointIndex = 0;
Vertexes* movingPoints = new Vertexes();
Vertexes* addedPoints = new Vertexes();
Vertexes* addedPoints = 0;
if ( mTopologyMovingVertexes.contains( resultIt.value().snappedAtGeometry ) )
{
addedPoints = mTopologyMovingVertexes[ resultIt.value().snappedAtGeometry ];
}
else
{
addedPoints = new Vertexes();
}
if ( tVertex == -1 ) // adding first point if needed
{
tVertex = tVertexBackup;
@@ -217,6 +217,7 @@ void QgsMapToolAddFeature::canvasMapReleaseEvent( QgsMapMouseEvent* e )
{
emit messageEmitted( tr( "Cannot add feature. Unknown WKB type" ), QgsMessageBar::CRITICAL );
stopCapturing();
delete f;
return; //unknown wkbtype
}

@@ -236,6 +237,7 @@ void QgsMapToolAddFeature::canvasMapReleaseEvent( QgsMapMouseEvent* e )
{
emit messageEmitted( tr( "Cannot add feature. Unknown WKB type" ), QgsMessageBar::CRITICAL );
stopCapturing();
delete f;
return; //unknown wkbtype
}

@@ -364,6 +364,7 @@ void QgsMapToolCapture::validateGeometry()

QStatusBar *sb = QgisApp::instance()->statusBar();
sb->showMessage( tr( "Validation started." ) );
delete g;
}

void QgsMapToolCapture::addError( QgsGeometry::Error e )
@@ -66,9 +66,7 @@ void QgsMapToolDeletePart::canvasPressEvent( QMouseEvent *e )
return;
}

QgsGeometry* geomPart;

geomPart = partUnderPoint( e->pos(), mPressedFid, mPressedPartNum );
QgsGeometry* geomPart = partUnderPoint( e->pos(), mPressedFid, mPressedPartNum );

if ( mPressedFid != -1 )
{
@@ -78,6 +76,7 @@ void QgsMapToolDeletePart::canvasPressEvent( QMouseEvent *e )
mRubberBand->show();
}

delete geomPart;
}

void QgsMapToolDeletePart::canvasReleaseEvent( QMouseEvent *e )
@@ -283,7 +283,9 @@ QgsGeometry* QgsMapToolOffsetCurve::createOriginGeometry( QgsVectorLayer* vl, co
++selIt;
for ( ; selIt != selectedFeatures.end(); ++selIt )
{
geom = geom->combine( selIt->geometry() );
QgsGeometry* combined = geom->combine( selIt->geometry() );
delete geom;
geom = combined;
}

//if multitype, return only the snapped to geometry
@@ -562,6 +562,8 @@ namespace pal
#ifdef _VERBOSE_
std::cerr << "Unknown search method..." << std::endl;
#endif
delete[] ok;
delete[] parts;
return;
}

0 comments on commit 7e66e33

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