Fix use-after-free bug in profile management
This commit is contained in:
parent
a3abb57480
commit
fac5d6550b
@ -211,7 +211,7 @@ namespace Online
|
||||
int userid_fetched = input->get("userid", &userid);
|
||||
setLastOnlineName(username);
|
||||
|
||||
m_profile = new OnlineProfile(userid, username, true);
|
||||
OnlineProfile* profile = new OnlineProfile(userid, username, true);
|
||||
assert(token_fetched && username_fetched && userid_fetched);
|
||||
m_online_state = OS_SIGNED_IN;
|
||||
if(rememberPassword())
|
||||
@ -219,7 +219,7 @@ namespace Online
|
||||
saveSession(getOnlineId(), getToken());
|
||||
}
|
||||
|
||||
ProfileManager::get()->addPersistent(m_profile);
|
||||
m_profile = ProfileManager::get()->addPersistent(profile);
|
||||
std::string achieved_string("");
|
||||
|
||||
// Even if no achievements were sent, we have to call sync
|
||||
|
@ -253,7 +253,7 @@ bool ProfileManager::inPersistent(const uint32_t id)
|
||||
* the friends, while the other could have fetched the achievements.)
|
||||
* \param profile The profile to make persistent.
|
||||
*/
|
||||
void ProfileManager::addPersistent(OnlineProfile * profile)
|
||||
OnlineProfile* ProfileManager::addPersistent(OnlineProfile * profile)
|
||||
{
|
||||
if (inPersistent(profile->getID()))
|
||||
{
|
||||
@ -263,6 +263,8 @@ void ProfileManager::addPersistent(OnlineProfile * profile)
|
||||
{
|
||||
m_profiles_persistent[profile->getID()] = profile;
|
||||
}
|
||||
|
||||
return m_profiles_persistent[profile->getID()];
|
||||
} // addPersistent
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -103,7 +103,7 @@ public:
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
void addToCache(OnlineProfile *profile);
|
||||
void addPersistent(OnlineProfile *profile);
|
||||
OnlineProfile* addPersistent(OnlineProfile *profile);
|
||||
void deleteFromPersistent(const uint32_t id);
|
||||
void clearPersistent();
|
||||
void moveToCache(const uint32_t id);
|
||||
|
Loading…
Reference in New Issue
Block a user