mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-27 23:17:13 +03:00
AccountManager: Fix small leak in the account migration code
The QSettings object was not deleted in every possible code paths
This commit is contained in:
parent
df773ea8bb
commit
06579a5c70
1 changed files with 2 additions and 4 deletions
|
@ -86,7 +86,7 @@ bool AccountManager::restoreFromLegacySettings()
|
||||||
|
|
||||||
QFileInfo fi( oCCfgFile );
|
QFileInfo fi( oCCfgFile );
|
||||||
if( fi.isReadable() ) {
|
if( fi.isReadable() ) {
|
||||||
QSettings *oCSettings = new QSettings(oCCfgFile, QSettings::IniFormat);
|
std::unique_ptr<QSettings> oCSettings(new QSettings(oCCfgFile, QSettings::IniFormat));
|
||||||
oCSettings->beginGroup(QLatin1String("ownCloud"));
|
oCSettings->beginGroup(QLatin1String("ownCloud"));
|
||||||
|
|
||||||
// Check the theme url to see if it is the same url that the oC config was for
|
// Check the theme url to see if it is the same url that the oC config was for
|
||||||
|
@ -101,9 +101,7 @@ bool AccountManager::restoreFromLegacySettings()
|
||||||
qDebug() << "Migrate oC config if " << oCUrl << " == " << overrideUrl << ":"
|
qDebug() << "Migrate oC config if " << oCUrl << " == " << overrideUrl << ":"
|
||||||
<< (oCUrl == overrideUrl ? "Yes" : "No");
|
<< (oCUrl == overrideUrl ? "Yes" : "No");
|
||||||
if( oCUrl == overrideUrl ) {
|
if( oCUrl == overrideUrl ) {
|
||||||
settings.reset( oCSettings );
|
settings = std::move(oCSettings);
|
||||||
} else {
|
|
||||||
delete oCSettings;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue