From: Olivier Goffart Date: Mon, 6 Apr 2015 14:20:28 +0000 (+0200) Subject: AccountState: Fix uninitialized memory access spotted by valgrind X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~1803^2~228 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=f4e2c8411133e2002232b26da12d534afa1c7976;p=nextcloud-desktop.git AccountState: Fix uninitialized memory access spotted by valgrind QuotaInfo's constructor uses the AccountState's _state which is initialized after --- diff --git a/src/gui/accountstate.cpp b/src/gui/accountstate.cpp index 0ccbfbc7e..43f876246 100644 --- a/src/gui/accountstate.cpp +++ b/src/gui/accountstate.cpp @@ -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*"); + _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*)),