Skip to content

Commit

Permalink
Fix memory leak, potential crash when creating QgsVectorLayerSimpleLa…
Browse files Browse the repository at this point in the history
…beling

Identified by Coverity
  • Loading branch information
nyalldawson committed May 29, 2017
1 parent fb76383 commit fa3e014
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/core/qgsvectorlayerlabeling.cpp
Expand Up @@ -78,13 +78,13 @@ bool QgsVectorLayerSimpleLabeling::requiresAdvancedEffects() const

QgsVectorLayerSimpleLabeling *QgsVectorLayerSimpleLabeling::create( const QDomElement &element, const QgsReadWriteContext &context )
{
QgsPalLayerSettings *settings = nullptr;
QDomElement settingsElem = element.firstChildElement( QStringLiteral( "settings" ) );
if ( !settingsElem.isNull() )
{
settings = new QgsPalLayerSettings;
settings->readXml( settingsElem, context );
QgsPalLayerSettings settings;
settings.readXml( settingsElem, context );
return new QgsVectorLayerSimpleLabeling( settings );
}

return new QgsVectorLayerSimpleLabeling( *settings );
return new QgsVectorLayerSimpleLabeling( QgsPalLayerSettings() );
}

0 comments on commit fa3e014

Please sign in to comment.