Skip to content
Permalink
Browse files

Remove some unnecessary delete guards

Via clang-tidy readability-delete-null-pointer
  • Loading branch information
nyalldawson committed Sep 11, 2017
1 parent ccf0dc8 commit d9ebd3b84b44a2f0fa4421422811abae97cbf33c
@@ -4402,8 +4402,7 @@ void QgisApp::askUserForOGRSublayers( QgsVectorLayer *layer )
{
QString msg = tr( "%1 is not a valid or recognized data source" ).arg( composedURI );
messageBar()->pushMessage( tr( "Invalid Data Source" ), msg, QgsMessageBar::CRITICAL, messageTimeout() );
if ( layer )
delete layer;
delete layer;
}
}

@@ -1983,8 +1983,7 @@ QgsExpressionNode *QgsOgcUtils::nodeLiteralFromOgcFilter( QDomElement &element,
operand = nodeFromOgcFilter( operandElem, errorMessage );
if ( !operand )
{
if ( root )
delete root;
delete root;

errorMessage = QObject::tr( "'%1' is an invalid or not supported content for ogc:Literal" ).arg( operandElem.tagName() );
return nullptr;
@@ -2075,14 +2074,9 @@ QgsExpressionNode *QgsOgcUtils::nodeIsBetweenFromOgcFilter( QDomElement &element

if ( !operand || !lowerBound || !operand2 || !upperBound )
{
if ( operand )
delete operand;

if ( lowerBound )
delete lowerBound;

if ( upperBound )
delete upperBound;
delete operand;
delete lowerBound;
delete upperBound;

errorMessage = QObject::tr( "missing some required sub-elements in ogc:PropertyIsBetween" );
return nullptr;
@@ -114,9 +114,7 @@ QgsVectorLayerExporter::QgsVectorLayerExporter( const QString &uri,
mError = ErrInvalidLayer;
mErrorMessage = QObject::tr( "Loading of layer failed" );

if ( vectorProvider )
delete vectorProvider;

delete vectorProvider;
return;
}

@@ -331,9 +331,7 @@ QgsRasterFileWriter::WriterError QgsRasterFileWriter::writeDataRaster( const Qgs
error = writeDataRaster( pipe, iter, nCols, nRows, outputExtent, crs, destDataType, destHasNoDataValueList, destNoDataValueList, destProvider, feedback );
}

if ( destProvider )
delete destProvider;

delete destProvider;
return error;
}

@@ -616,8 +614,7 @@ QgsRasterFileWriter::WriterError QgsRasterFileWriter::writeImageRaster( QgsRaste
++fileIndex;
}

if ( destProvider )
delete destProvider;
delete destProvider;

qgsFree( redData );
qgsFree( greenData );
@@ -1032,7 +1032,8 @@ bool QgsDelimitedTextProvider::setSubsetString( const QString &subset, bool upda
QString previousSubset = mSubsetString;
mSubsetString = nonNullSubset;
mSubsetExpression = expression;
if ( tmpSubsetExpression ) delete tmpSubsetExpression;
delete tmpSubsetExpression;

// Update the feature count and extents if requested

// Usage of updateFeatureCount is a bit painful, basically expect that it

0 comments on commit d9ebd3b

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