Fixed memory leak.
This commit is contained in:
parent
0c48c00fa7
commit
7a67274a18
1 changed files with 11 additions and 11 deletions
|
@ -244,8 +244,7 @@ void LanLinkProvider::connected()
|
||||||
mUdpSocket.writeDatagram(np2.serialize(), receivedIdentityPackages[socket].sender, port);
|
mUdpSocket.writeDatagram(np2.serialize(), receivedIdentityPackages[socket].sender, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete receivedPackage;
|
delete receivedIdentityPackages.take(socket).np;
|
||||||
receivedIdentityPackages.remove(socket);
|
|
||||||
//We don't delete the socket because now it's owned by the LanDeviceLink
|
//We don't delete the socket because now it's owned by the LanDeviceLink
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,8 +264,7 @@ void LanLinkProvider::encrypted()
|
||||||
addLink(deviceId, socket, receivedPackage, LanDeviceLink::Remotely);
|
addLink(deviceId, socket, receivedPackage, LanDeviceLink::Remotely);
|
||||||
|
|
||||||
// Copied from connected slot, now delete received package
|
// Copied from connected slot, now delete received package
|
||||||
delete receivedPackage;
|
delete receivedIdentityPackages.take(socket).np;
|
||||||
receivedIdentityPackages.remove(socket);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,8 +340,14 @@ void LanLinkProvider::dataReceived()
|
||||||
NetworkPackage* np = new NetworkPackage("");
|
NetworkPackage* np = new NetworkPackage("");
|
||||||
bool success = NetworkPackage::unserialize(data, np);
|
bool success = NetworkPackage::unserialize(data, np);
|
||||||
|
|
||||||
if (!success || np->type() != PACKAGE_TYPE_IDENTITY) {
|
if (!success) {
|
||||||
qCDebug(KDECONNECT_CORE) << "LanLinkProvider/newConnection: Not an identification package (wuh?)";
|
delete np;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (np->type() != PACKAGE_TYPE_IDENTITY) {
|
||||||
|
qCWarning(KDECONNECT_CORE) << "LanLinkProvider/newConnection: Expected identity, received " << np->type();
|
||||||
|
delete np;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -379,14 +383,10 @@ void LanLinkProvider::dataReceived()
|
||||||
connect(socket, SIGNAL(encrypted()), this, SLOT(encrypted()));
|
connect(socket, SIGNAL(encrypted()), this, SLOT(encrypted()));
|
||||||
|
|
||||||
socket->startClientEncryption();
|
socket->startClientEncryption();
|
||||||
return;
|
|
||||||
} else {
|
} else {
|
||||||
addLink(deviceId, socket, np, LanDeviceLink::Locally);
|
addLink(deviceId, socket, np, LanDeviceLink::Locally);
|
||||||
|
delete receivedIdentityPackages.take(socket).np;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete np;
|
|
||||||
receivedIdentityPackages.remove(socket);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LanLinkProvider::deviceLinkDestroyed(QObject* destroyedDeviceLink)
|
void LanLinkProvider::deviceLinkDestroyed(QObject* destroyedDeviceLink)
|
||||||
|
|
Loading…
Reference in a new issue