diff options
author | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-09-13 02:08:22 (GMT) |
---|---|---|
committer | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-09-13 03:48:41 (GMT) |
commit | b7d98cb89889032d7fc7b7e16b5183305dfb714b (patch) | |
tree | a9aef5de2aed5fb5b5c6887d9bc7d4d0b5168b0e /src | |
parent | d9f5115eb7f7ba78db245ff9e66ae638317f5b70 (diff) | |
download | Qt-b7d98cb89889032d7fc7b7e16b5183305dfb714b.zip Qt-b7d98cb89889032d7fc7b7e16b5183305dfb714b.tar.gz Qt-b7d98cb89889032d7fc7b7e16b5183305dfb714b.tar.bz2 |
Fix memory leaks and valgrind errors.
Diffstat (limited to 'src')
-rw-r--r-- | src/network/bearer/qbearerengine.cpp | 3 | ||||
-rw-r--r-- | src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp | 11 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/network/bearer/qbearerengine.cpp b/src/network/bearer/qbearerengine.cpp index 2f8624a..b074924 100644 --- a/src/network/bearer/qbearerengine.cpp +++ b/src/network/bearer/qbearerengine.cpp @@ -58,18 +58,21 @@ QBearerEngine::~QBearerEngine() it.value()->isValid = false; it.value()->id.clear(); } + snapConfigurations.clear(); for (it = accessPointConfigurations.begin(), end = accessPointConfigurations.end(); it != end; ++it) { it.value()->isValid = false; it.value()->id.clear(); } + accessPointConfigurations.clear(); for (it = userChoiceConfigurations.begin(), end = userChoiceConfigurations.end(); it != end; ++it) { it.value()->isValid = false; it.value()->id.clear(); } + userChoiceConfigurations.clear(); } bool QBearerEngine::requiresPolling() const diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp index 29445ce..554f9b7 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp @@ -97,6 +97,10 @@ QNetworkManagerEngine::QNetworkManagerEngine(QObject *parent) QNetworkManagerEngine::~QNetworkManagerEngine() { + qDeleteAll(connections); + qDeleteAll(accessPoints); + qDeleteAll(wirelessDevices); + qDeleteAll(activeConnections); } void QNetworkManagerEngine::initialize() @@ -389,7 +393,7 @@ void QNetworkManagerEngine::deviceRemoved(const QDBusObjectPath &path) { QMutexLocker locker(&mutex); - delete wirelessDevices.value(path.path()); + delete wirelessDevices.take(path.path()); } void QNetworkManagerEngine::newConnection(const QDBusObjectPath &path, @@ -455,6 +459,8 @@ void QNetworkManagerEngine::removeConnection(const QString &path) QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(id); + connection->deleteLater(); + locker.unlock(); emit configurationRemoved(ptr); } @@ -631,7 +637,8 @@ void QNetworkManagerEngine::removeAccessPoint(const QString &path, locker.unlock(); emit configurationChanged(ptr); - return; + locker.relock(); + break; } } } else { |