diff options
| author | Tobias Markmann <tm@ayena.de> | 2015-06-30 07:02:01 (GMT) |
|---|---|---|
| committer | Kevin Smith <kevin.smith@isode.com> | 2015-07-07 19:58:12 (GMT) |
| commit | 799a7ac203dc2576872894dfdd1adb5cdbbacf7b (patch) | |
| tree | e0242decf49222b83674143cf04f61c3dc01bc35 /Swiften/FileTransfer/JingleFileTransfer.cpp | |
| parent | abd96284e162b3594bd0fc90a5da6b78709dee23 (diff) | |
| download | swift-799a7ac203dc2576872894dfdd1adb5cdbbacf7b.zip swift-799a7ac203dc2576872894dfdd1adb5cdbbacf7b.tar.bz2 | |
Fix memory leaks reported by ASAN
Test-Information:
Tested on Elementary OS with a LLVM/Clang 3.7.0 build. With this patch
the reports for the fixed locations are gone.
Change-Id: I0260fc85ad662335a69ace331f51ebe2f864ef97
Diffstat (limited to 'Swiften/FileTransfer/JingleFileTransfer.cpp')
| -rw-r--r-- | Swiften/FileTransfer/JingleFileTransfer.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/Swiften/FileTransfer/JingleFileTransfer.cpp b/Swiften/FileTransfer/JingleFileTransfer.cpp index dbc4391..cf67a67 100644 --- a/Swiften/FileTransfer/JingleFileTransfer.cpp +++ b/Swiften/FileTransfer/JingleFileTransfer.cpp | |||
| @@ -8,13 +8,13 @@ | |||
| 8 | 8 | ||
| 9 | #include <boost/typeof/typeof.hpp> | 9 | #include <boost/typeof/typeof.hpp> |
| 10 | 10 | ||
| 11 | #include <Swiften/Base/Log.h> | ||
| 11 | #include <Swiften/Base/foreach.h> | 12 | #include <Swiften/Base/foreach.h> |
| 12 | #include <Swiften/JID/JID.h> | ||
| 13 | #include <Swiften/Crypto/CryptoProvider.h> | 13 | #include <Swiften/Crypto/CryptoProvider.h> |
| 14 | #include <Swiften/StringCodecs/Hexify.h> | ||
| 15 | #include <Swiften/Jingle/JingleSession.h> | ||
| 16 | #include <Swiften/FileTransfer/FileTransferTransporter.h> | 14 | #include <Swiften/FileTransfer/FileTransferTransporter.h> |
| 17 | #include <Swiften/Base/Log.h> | 15 | #include <Swiften/JID/JID.h> |
| 16 | #include <Swiften/Jingle/JingleSession.h> | ||
| 17 | #include <Swiften/StringCodecs/Hexify.h> | ||
| 18 | 18 | ||
| 19 | using namespace Swift; | 19 | using namespace Swift; |
| 20 | 20 | ||
| @@ -213,6 +213,7 @@ void JingleFileTransfer::handleTransportInfoReceived( | |||
| 213 | } | 213 | } |
| 214 | 214 | ||
| 215 | void JingleFileTransfer::setTransporter(FileTransferTransporter* transporter) { | 215 | void JingleFileTransfer::setTransporter(FileTransferTransporter* transporter) { |
| 216 | SWIFT_LOG_ASSERT(!this->transporter, error); | ||
| 216 | this->transporter = transporter; | 217 | this->transporter = transporter; |
| 217 | localTransportCandidatesGeneratedConnection = transporter->onLocalCandidatesGenerated.connect( | 218 | localTransportCandidatesGeneratedConnection = transporter->onLocalCandidatesGenerated.connect( |
| 218 | boost::bind(&JingleFileTransfer::handleLocalTransportCandidatesGenerated, this, _1, _2, _3)); | 219 | boost::bind(&JingleFileTransfer::handleLocalTransportCandidatesGenerated, this, _1, _2, _3)); |
| @@ -222,3 +223,13 @@ void JingleFileTransfer::setTransporter(FileTransferTransporter* transporter) { | |||
| 222 | boost::bind(&JingleFileTransfer::handleProxyActivateFinished, this, _1, _2)); | 223 | boost::bind(&JingleFileTransfer::handleProxyActivateFinished, this, _1, _2)); |
| 223 | } | 224 | } |
| 224 | 225 | ||
| 226 | void JingleFileTransfer::removeTransporter() { | ||
| 227 | if (transporter) { | ||
| 228 | localTransportCandidatesGeneratedConnection.release(); | ||
| 229 | remoteTransportCandidateSelectFinishedConnection.release(); | ||
| 230 | proxyActivatedConnection.release(); | ||
| 231 | delete transporter; | ||
| 232 | transporter = NULL; | ||
| 233 | } | ||
| 234 | } | ||
| 235 | |||
Swift