Skip to content

Commit

Permalink
Fix leak
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson authored and github-actions[bot] committed Dec 17, 2024
1 parent a27931e commit 2ba1cf4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/core/classification/qgsclassificationmethodregistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ bool QgsClassificationMethodRegistry::addMethod( QgsClassificationMethod *method

QgsClassificationMethod *QgsClassificationMethodRegistry::method( const QString &id )
{
QgsClassificationMethod *method = mMethods.value( id, new QgsClassificationCustom() );
return method->clone();
auto it = mMethods.constFind( id );
if ( it == mMethods.constEnd() )
return new QgsClassificationCustom();
return it.value()->clone();
}

QMap<QString, QString> QgsClassificationMethodRegistry::methodNames() const
Expand Down

0 comments on commit 2ba1cf4

Please sign in to comment.