diff options
| author | Tobias Markmann <tm@ayena.de> | 2015-10-06 07:30:56 (GMT) |
|---|---|---|
| committer | Tobias Markmann <tm@ayena.de> | 2015-10-14 14:35:55 (GMT) |
| commit | b00c84574fc730eeeabb57df1f17b54855218193 (patch) | |
| tree | bbc05725a01a12b832065beb9f5eb20d71cb3178 /Swiften/Disco/DiscoServiceWalker.cpp | |
| parent | a30c7ad74fc830dbd10b9560054f39063b5e8372 (diff) | |
| download | swift-b00c84574fc730eeeabb57df1f17b54855218193.zip swift-b00c84574fc730eeeabb57df1f17b54855218193.tar.bz2 | |
Fix memory leak warnings by Valgrind/LSAN
Test-Information:
Both Valgrind and clang's leak sanitizer report a lot leaks
on the FileTransferTest. With this commit it the stack traces
related to the fixed leaks are gone.
Change-Id: Idae9a81bcd8d97576d3f1469bf64490e0bfa7d55
Diffstat (limited to 'Swiften/Disco/DiscoServiceWalker.cpp')
| -rw-r--r-- | Swiften/Disco/DiscoServiceWalker.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Swiften/Disco/DiscoServiceWalker.cpp b/Swiften/Disco/DiscoServiceWalker.cpp index f84262b..5803602 100644 --- a/Swiften/Disco/DiscoServiceWalker.cpp +++ b/Swiften/Disco/DiscoServiceWalker.cpp | |||
| @@ -1,18 +1,18 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (c) 2010 Isode Limited. | 2 | * Copyright (c) 2010-2015 Isode Limited. |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * See the COPYING file for more information. | 4 | * See the COPYING file for more information. |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | #include <Swiften/Disco/DiscoServiceWalker.h> | 7 | #include <Swiften/Disco/DiscoServiceWalker.h> |
| 8 | 8 | ||
| 9 | #include <boost/bind.hpp> | ||
| 10 | |||
| 9 | #include <Swiften/Base/Log.h> | 11 | #include <Swiften/Base/Log.h> |
| 10 | #include <Swiften/Base/foreach.h> | 12 | #include <Swiften/Base/foreach.h> |
| 11 | 13 | ||
| 12 | #include <boost/bind.hpp> | ||
| 13 | |||
| 14 | namespace Swift { | 14 | namespace Swift { |
| 15 | 15 | ||
| 16 | DiscoServiceWalker::DiscoServiceWalker(const JID& service, IQRouter* iqRouter, size_t maxSteps) : service_(service), iqRouter_(iqRouter), maxSteps_(maxSteps), active_(false) { | 16 | DiscoServiceWalker::DiscoServiceWalker(const JID& service, IQRouter* iqRouter, size_t maxSteps) : service_(service), iqRouter_(iqRouter), maxSteps_(maxSteps), active_(false) { |
| 17 | 17 | ||
| 18 | } | 18 | } |
| @@ -55,10 +55,11 @@ void DiscoServiceWalker::handleDiscoInfoResponse(boost::shared_ptr<DiscoInfo> in | |||
| 55 | return; | 55 | return; |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | SWIFT_LOG(debug) << "Disco info response from " << request->getReceiver() << std::endl; | 58 | SWIFT_LOG(debug) << "Disco info response from " << request->getReceiver() << std::endl; |
| 59 | 59 | ||
| 60 | request->onResponse.disconnect(boost::bind(&DiscoServiceWalker::handleDiscoInfoResponse, this, _1, _2, request)); | ||
| 60 | pendingDiscoInfoRequests_.erase(request); | 61 | pendingDiscoInfoRequests_.erase(request); |
| 61 | if (error) { | 62 | if (error) { |
| 62 | handleDiscoError(request->getReceiver(), error); | 63 | handleDiscoError(request->getReceiver(), error); |
| 63 | return; | 64 | return; |
| 64 | } | 65 | } |
| @@ -89,10 +90,11 @@ void DiscoServiceWalker::handleDiscoItemsResponse(boost::shared_ptr<DiscoItems> | |||
| 89 | if (!active_) { | 90 | if (!active_) { |
| 90 | return; | 91 | return; |
| 91 | } | 92 | } |
| 92 | 93 | ||
| 93 | SWIFT_LOG(debug) << "Received disco items from " << request->getReceiver() << std::endl; | 94 | SWIFT_LOG(debug) << "Received disco items from " << request->getReceiver() << std::endl; |
| 95 | request->onResponse.disconnect(boost::bind(&DiscoServiceWalker::handleDiscoItemsResponse, this, _1, _2, request)); | ||
| 94 | pendingDiscoItemsRequests_.erase(request); | 96 | pendingDiscoItemsRequests_.erase(request); |
| 95 | if (error) { | 97 | if (error) { |
| 96 | handleDiscoError(request->getReceiver(), error); | 98 | handleDiscoError(request->getReceiver(), error); |
| 97 | return; | 99 | return; |
| 98 | } | 100 | } |
Swift