AccountState: Fix uninitialized memory access spotted by valgrind
authorOlivier Goffart <ogoffart@woboq.com>
Mon, 6 Apr 2015 14:20:28 +0000 (16:20 +0200)
committerOlivier Goffart <ogoffart@woboq.com>
Mon, 6 Apr 2015 14:21:05 +0000 (16:21 +0200)
QuotaInfo's constructor uses the AccountState's _state which is
initialized after

src/gui/accountstate.cpp

index 0ccbfbc7e2b974bb7ee6b3c01d9f1d74c0d9759f..43f876246af26556f94f88fb0c836b96f168ff23 100644 (file)
@@ -56,13 +56,15 @@ void AccountStateManager::slotAccountAdded(AccountPtr account)
 AccountState::AccountState(AccountPtr account)
     : QObject(account.data())
     , _account(account)
-    , _quotaInfo(new QuotaInfo(this))
+    , _quotaInfo(0)
     , _state(AccountState::Disconnected)
     , _connectionStatus(ConnectionValidator::Undefined)
     , _waitingForNewCredentials(false)
 {
     qRegisterMetaType<AccountState*>("AccountState*");
 
+    _quotaInfo = new QuotaInfo(this); // Need to be initialized when 'this' is fully initialized
+
     connect(account.data(), SIGNAL(invalidCredentials()),
             SLOT(slotInvalidCredentials()));
     connect(account.data(), SIGNAL(credentialsFetched(AbstractCredentials*)),