diff options
| author | Tobias Markmann <tm@ayena.de> | 2015-06-19 12:45:31 (GMT) |
|---|---|---|
| committer | Kevin Smith <kevin.smith@isode.com> | 2015-07-08 07:08:08 (GMT) |
| commit | a2b065eb22755f9341c58096805875021faffa67 (patch) | |
| tree | 0283b12cc160260e5b1c04d377dbab6ebef7fe36 /Swiften/FileTransfer | |
| parent | 07544ee46ffda935714dfc36e5bc5582a7d8c2b0 (diff) | |
| download | swift-a2b065eb22755f9341c58096805875021faffa67.zip swift-a2b065eb22755f9341c58096805875021faffa67.tar.bz2 | |
Stop timer when SOCKS5BytestreamClientSession is deleted
ASAN reported heap-use-after-free because if the timer is running
and an instance is freed, the signal of the timer is still emitted and
connected slots are called.
Test-Information:
Tested that the ASAN report wents away with this fix.
Change-Id: Id785737c4c015e5c638e9d9f6419d740d6cf83b9
Diffstat (limited to 'Swiften/FileTransfer')
| -rw-r--r-- | Swiften/FileTransfer/SOCKS5BytestreamClientSession.cpp | 7 | ||||
| -rw-r--r-- | Swiften/FileTransfer/SOCKS5BytestreamClientSession.h | 18 |
2 files changed, 16 insertions, 9 deletions
diff --git a/Swiften/FileTransfer/SOCKS5BytestreamClientSession.cpp b/Swiften/FileTransfer/SOCKS5BytestreamClientSession.cpp index 4a0cd67..04d5d86 100644 --- a/Swiften/FileTransfer/SOCKS5BytestreamClientSession.cpp +++ b/Swiften/FileTransfer/SOCKS5BytestreamClientSession.cpp | |||
| @@ -16,13 +16,13 @@ | |||
| 16 | #include <boost/numeric/conversion/cast.hpp> | 16 | #include <boost/numeric/conversion/cast.hpp> |
| 17 | 17 | ||
| 18 | #include <Swiften/Base/Algorithm.h> | 18 | #include <Swiften/Base/Algorithm.h> |
| 19 | #include <Swiften/Base/SafeByteArray.h> | 19 | #include <Swiften/Base/ByteArray.h> |
| 20 | #include <Swiften/Base/Concat.h> | 20 | #include <Swiften/Base/Concat.h> |
| 21 | #include <Swiften/Base/Log.h> | 21 | #include <Swiften/Base/Log.h> |
| 22 | #include <Swiften/StringCodecs/Hexify.h> | 22 | #include <Swiften/Base/SafeByteArray.h> |
| 23 | #include <Swiften/FileTransfer/BytestreamException.h> | 23 | #include <Swiften/FileTransfer/BytestreamException.h> |
| 24 | #include <Swiften/Network/TimerFactory.h> | 24 | #include <Swiften/Network/TimerFactory.h> |
| 25 | #include <Swiften/Base/ByteArray.h> | 25 | #include <Swiften/StringCodecs/Hexify.h> |
| 26 | 26 | ||
| 27 | namespace Swift { | 27 | namespace Swift { |
| 28 | 28 | ||
| @@ -42,6 +42,7 @@ SOCKS5BytestreamClientSession::SOCKS5BytestreamClientSession( | |||
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | SOCKS5BytestreamClientSession::~SOCKS5BytestreamClientSession() { | 44 | SOCKS5BytestreamClientSession::~SOCKS5BytestreamClientSession() { |
| 45 | weFailedTimeout->stop(); | ||
| 45 | } | 46 | } |
| 46 | 47 | ||
| 47 | void SOCKS5BytestreamClientSession::start() { | 48 | void SOCKS5BytestreamClientSession::start() { |
diff --git a/Swiften/FileTransfer/SOCKS5BytestreamClientSession.h b/Swiften/FileTransfer/SOCKS5BytestreamClientSession.h index cf731c1..1c0563a 100644 --- a/Swiften/FileTransfer/SOCKS5BytestreamClientSession.h +++ b/Swiften/FileTransfer/SOCKS5BytestreamClientSession.h | |||
| @@ -4,16 +4,22 @@ | |||
| 4 | * See Documentation/Licenses/BSD-simplified.txt for more information. | 4 | * See Documentation/Licenses/BSD-simplified.txt for more information. |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | /* | ||
| 8 | * Copyright (c) 2015 Isode Limited. | ||
| 9 | * All rights reserved. | ||
| 10 | * See the COPYING file for more information. | ||
| 11 | */ | ||
| 12 | |||
| 7 | #pragma once | 13 | #pragma once |
| 8 | 14 | ||
| 9 | #include <boost/shared_ptr.hpp> | ||
| 10 | #include <boost/optional.hpp> | 15 | #include <boost/optional.hpp> |
| 16 | #include <boost/shared_ptr.hpp> | ||
| 11 | 17 | ||
| 12 | #include <Swiften/Base/API.h> | 18 | #include <Swiften/Base/API.h> |
| 13 | #include <Swiften/Base/ByteArray.h> | 19 | #include <Swiften/Base/ByteArray.h> |
| 14 | #include <Swiften/FileTransfer/FileTransferError.h> | 20 | #include <Swiften/FileTransfer/FileTransferError.h> |
| 15 | #include <Swiften/FileTransfer/WriteBytestream.h> | ||
| 16 | #include <Swiften/FileTransfer/ReadBytestream.h> | 21 | #include <Swiften/FileTransfer/ReadBytestream.h> |
| 22 | #include <Swiften/FileTransfer/WriteBytestream.h> | ||
| 17 | #include <Swiften/JID/JID.h> | 23 | #include <Swiften/JID/JID.h> |
| 18 | #include <Swiften/Network/Connection.h> | 24 | #include <Swiften/Network/Connection.h> |
| 19 | #include <Swiften/Network/HostAddressPort.h> | 25 | #include <Swiften/Network/HostAddressPort.h> |
| @@ -96,10 +102,10 @@ private: | |||
| 96 | 102 | ||
| 97 | Timer::ref weFailedTimeout; | 103 | Timer::ref weFailedTimeout; |
| 98 | 104 | ||
| 99 | boost::bsignals::connection connectFinishedConnection; | 105 | boost::bsignals::scoped_connection connectFinishedConnection; |
| 100 | boost::bsignals::connection dataWrittenConnection; | 106 | boost::bsignals::scoped_connection dataWrittenConnection; |
| 101 | boost::bsignals::connection dataReadConnection; | 107 | boost::bsignals::scoped_connection dataReadConnection; |
| 102 | boost::bsignals::connection disconnectedConnection; | 108 | boost::bsignals::scoped_connection disconnectedConnection; |
| 103 | }; | 109 | }; |
| 104 | 110 | ||
| 105 | } | 111 | } |
Swift