From b9edc9bbf5e304a1b2cec8f963c0d8d53ff0e2f2 Mon Sep 17 00:00:00 2001
From: Tobias Markmann <tm@ayena.de>
Date: Thu, 16 Jul 2015 10:01:48 +0200
Subject: Fix memory leak in SOCKS5BytestreamServerManager

Test-Information:

This LSAN reported leak is gone with this fix.

Change-Id: Ib25fdfb7f4a82f62cd3f82ddb99f45618ea72ea9

diff --git a/Swiften/FileTransfer/SOCKS5BytestreamServerManager.cpp b/Swiften/FileTransfer/SOCKS5BytestreamServerManager.cpp
index 3137163..f531856 100644
--- a/Swiften/FileTransfer/SOCKS5BytestreamServerManager.cpp
+++ b/Swiften/FileTransfer/SOCKS5BytestreamServerManager.cpp
@@ -12,21 +12,21 @@
 
 #include <Swiften/FileTransfer/SOCKS5BytestreamServerManager.h>
 
-#include <boost/smart_ptr/make_shared.hpp>
 #include <boost/bind.hpp>
+#include <boost/smart_ptr/make_shared.hpp>
 
-#include <Swiften/FileTransfer/SOCKS5BytestreamServerResourceUser.h>
-#include <Swiften/FileTransfer/SOCKS5BytestreamServerPortForwardingUser.h>
-#include <Swiften/Base/foreach.h>
 #include <Swiften/Base/Log.h>
+#include <Swiften/Base/foreach.h>
 #include <Swiften/FileTransfer/SOCKS5BytestreamServer.h>
+#include <Swiften/FileTransfer/SOCKS5BytestreamServerPortForwardingUser.h>
+#include <Swiften/FileTransfer/SOCKS5BytestreamServerResourceUser.h>
 #include <Swiften/Network/ConnectionServer.h>
 #include <Swiften/Network/ConnectionServerFactory.h>
-#include <Swiften/Network/NetworkEnvironment.h>
-#include <Swiften/Network/NATTraverser.h>
-#include <Swiften/Network/NATTraversalGetPublicIPRequest.h>
 #include <Swiften/Network/NATTraversalForwardPortRequest.h>
+#include <Swiften/Network/NATTraversalGetPublicIPRequest.h>
 #include <Swiften/Network/NATTraversalRemovePortForwardingRequest.h>
+#include <Swiften/Network/NATTraverser.h>
+#include <Swiften/Network/NetworkEnvironment.h>
 
 using namespace Swift;
 
@@ -194,6 +194,7 @@ void SOCKS5BytestreamServerManager::stop() {
 	}
 	if (server) {
 		server->stop();
+		delete server;
 		server = NULL;
 	}
 	if (connectionServer) {
-- 
cgit v0.10.2-6-g49f6