1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Fix leak, enable NRVO in Core::getUsername

This commit is contained in:
Tux3 / Mlkj / !Lev.uXFMLA 2014-10-26 21:18:45 +01:00
parent edca806af1
commit 3047a65120
No known key found for this signature in database
GPG Key ID: 7E086DD661263264

View File

@ -959,13 +959,13 @@ void Core::removeGroup(int groupId)
QString Core::getUsername() QString Core::getUsername()
{ {
QString sname;
int size = tox_get_self_name_size(tox); int size = tox_get_self_name_size(tox);
uint8_t* name = new uint8_t[size]; uint8_t* name = new uint8_t[size];
if (tox_get_self_name(tox, name) == size) if (tox_get_self_name(tox, name) == size)
return QString(CString::toString(name, size)); sname = CString::toString(name, size);
else
return QString();
delete[] name; delete[] name;
return sname;
} }
void Core::setUsername(const QString& username) void Core::setUsername(const QString& username)