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/QA | |
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/QA')
-rw-r--r-- | Swiften/QA/FileTransferTest/FileTransferTest.cpp | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/Swiften/QA/FileTransferTest/FileTransferTest.cpp b/Swiften/QA/FileTransferTest/FileTransferTest.cpp index 2d2d6c8..8faf8a9 100644 --- a/Swiften/QA/FileTransferTest/FileTransferTest.cpp +++ b/Swiften/QA/FileTransferTest/FileTransferTest.cpp @@ -7,28 +7,28 @@ #include <fstream> #include <boost/algorithm/string.hpp> -#include <boost/numeric/conversion/cast.hpp> #include <boost/filesystem.hpp> +#include <boost/numeric/conversion/cast.hpp> -#include <Swiften/Base/sleep.h> -#include <Swiften/Base/foreach.h> +#include <Swiften/Base/BoostRandomGenerator.h> +#include <Swiften/Base/Debug.h> #include <Swiften/Base/Log.h> -#include <Swiften/Client/ClientXMLTracer.h> +#include <Swiften/Base/foreach.h> +#include <Swiften/Base/sleep.h> #include <Swiften/Client/Client.h> -#include <Swiften/EventLoop/SimpleEventLoop.h> -#include <Swiften/Network/BoostNetworkFactories.h> -#include <Swiften/Network/Timer.h> -#include <Swiften/Network/TimerFactory.h> +#include <Swiften/Client/ClientXMLTracer.h> +#include <Swiften/Disco/ClientDiscoManager.h> #include <Swiften/Disco/EntityCapsProvider.h> #include <Swiften/Elements/Presence.h> -#include <Swiften/FileTransfer/ReadBytestream.h> -#include <Swiften/Base/BoostRandomGenerator.h> +#include <Swiften/EventLoop/SimpleEventLoop.h> #include <Swiften/FileTransfer/FileReadBytestream.h> -#include <Swiften/FileTransfer/OutgoingFileTransfer.h> #include <Swiften/FileTransfer/FileTransferManager.h> -#include <Swiften/Disco/ClientDiscoManager.h> #include <Swiften/FileTransfer/FileWriteBytestream.h> -#include <Swiften/Base/Debug.h> +#include <Swiften/FileTransfer/OutgoingFileTransfer.h> +#include <Swiften/FileTransfer/ReadBytestream.h> +#include <Swiften/Network/BoostNetworkFactories.h> +#include <Swiften/Network/Timer.h> +#include <Swiften/Network/TimerFactory.h> using namespace Swift; @@ -59,8 +59,8 @@ class FileTransferTest { receiver_->onConnected.connect(boost::bind(&FileTransferTest::handleReceiverConnected, this)); receiver_->onDisconnected.connect(boost::bind(&FileTransferTest::handleReceiverDisconnected, this, _1)); - new ClientXMLTracer(sender_.get()); - new ClientXMLTracer(receiver_.get()); + senderTracer_ = new ClientXMLTracer(sender_.get()); + receiverTracer_ = new ClientXMLTracer(receiver_.get()); ClientOptions options; options.useTLS = ClientOptions::NeverUseTLS; @@ -92,6 +92,9 @@ class FileTransferTest { ~FileTransferTest() { timeOut_->stop(); + delete senderTracer_; + delete receiverTracer_; + if(boost::filesystem::exists(sendFilePath_)) { boost::filesystem::remove(sendFilePath_); } @@ -239,6 +242,7 @@ class FileTransferTest { private: int senderCandidates_; boost::shared_ptr<Client> sender_; + ClientXMLTracer* senderTracer_; ByteArray sendData_; OutgoingFileTransfer::ref outgoingFileTransfer_; boost::filesystem::path sendFilePath_; @@ -247,6 +251,7 @@ class FileTransferTest { int receiverCandidates_; boost::shared_ptr<Client> receiver_; + ClientXMLTracer* receiverTracer_; ByteArray receiveData_; std::vector<IncomingFileTransfer::ref> incomingFileTransfers_; boost::filesystem::path receiveFilePath_; |