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,22 +1,22 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2015 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swiften/Disco/DiscoServiceWalker.h> +#include <boost/bind.hpp> + #include <Swiften/Base/Log.h> #include <Swiften/Base/foreach.h> -#include <boost/bind.hpp> - namespace Swift { DiscoServiceWalker::DiscoServiceWalker(const JID& service, IQRouter* iqRouter, size_t maxSteps) : service_(service), iqRouter_(iqRouter), maxSteps_(maxSteps), active_(false) { } void DiscoServiceWalker::beginWalk() { SWIFT_LOG(debug) << "Starting walk to " << service_ << std::endl; assert(!active_); @@ -51,18 +51,19 @@ void DiscoServiceWalker::walkNode(const JID& jid) { void DiscoServiceWalker::handleDiscoInfoResponse(boost::shared_ptr<DiscoInfo> info, ErrorPayload::ref error, GetDiscoInfoRequest::ref request) { /* If we got canceled, don't do anything */ if (!active_) { return; } SWIFT_LOG(debug) << "Disco info response from " << request->getReceiver() << std::endl; + request->onResponse.disconnect(boost::bind(&DiscoServiceWalker::handleDiscoInfoResponse, this, _1, _2, request)); pendingDiscoInfoRequests_.erase(request); if (error) { handleDiscoError(request->getReceiver(), error); return; } bool couldContainServices = false; foreach (DiscoInfo::Identity identity, info->getIdentities()) { if (identity.getCategory() == "server") { @@ -85,18 +86,19 @@ void DiscoServiceWalker::handleDiscoInfoResponse(boost::shared_ptr<DiscoInfo> in } void DiscoServiceWalker::handleDiscoItemsResponse(boost::shared_ptr<DiscoItems> items, ErrorPayload::ref error, GetDiscoItemsRequest::ref request) { /* If we got canceled, don't do anything */ if (!active_) { return; } SWIFT_LOG(debug) << "Received disco items from " << request->getReceiver() << std::endl; + request->onResponse.disconnect(boost::bind(&DiscoServiceWalker::handleDiscoItemsResponse, this, _1, _2, request)); pendingDiscoItemsRequests_.erase(request); if (error) { handleDiscoError(request->getReceiver(), error); return; } foreach (DiscoItems::Item item, items->getItems()) { if (item.getNode().empty()) { /* Don't look at noded items. It's possible that this will exclude some services, * but I've never seen one in the wild, and it's an easy fix for not looping. |
Swift