Changeset - 0729d364ca25
[Not reviewed]
0 2 0
Vladimír Matěna - 9 years ago 2016-09-16 23:45:34
vlada.matena@gmail.com
Fix double free in DummyConnectionServer

Do not create shared ptr from this as this lead to double free in
UserRegistryTest::login test. Shared ptr was needed to set event
owner in acceptConnection, actually it is never needed as events
are never filtered by owner. Thus it was removed and there is no
need to create shared ptr from this.
2 files changed with 2 insertions and 5 deletions:
0 comments (0 inline, 0 general)
include/Swiften/Network/DummyConnectionServer.cpp
Show inline comments
 
@@ -30,8 +30,7 @@ void DummyConnectionServer::stop() {
 

	
 
void DummyConnectionServer::acceptConnection(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Swift::Connection> connection) {
 
		eventLoop->postEvent(
 
				boost::bind(boost::ref(onNewConnection), connection), 
 
				SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<DummyConnectionServer>(this));
 
				boost::bind(boost::ref(onNewConnection), connection));
 
// 		connection->listen();
 
}
 

	
include/Swiften/Network/DummyConnectionServer.h
Show inline comments
 
@@ -19,10 +19,8 @@
 
#include "Swiften/SwiftenCompat.h"
 

	
 
namespace Swift {
 
	class DummyConnectionServer : public ConnectionServer, public EventOwner, public boost::enable_shared_from_this<DummyConnectionServer> {
 
	class DummyConnectionServer : public ConnectionServer {
 
		public:
 
			typedef SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<DummyConnectionServer> ref;
 

	
 
			enum Error {
 
				Conflict,
 
				UnknownError
0 comments (0 inline, 0 general)