Index: trunk/BNC/src/upload/bncuploadcaster.cpp
===================================================================
--- trunk/BNC/src/upload/bncuploadcaster.cpp	(revision 7660)
+++ trunk/BNC/src/upload/bncuploadcaster.cpp	(revision 7661)
@@ -11,10 +11,10 @@
  * Created:    29-Mar-2011
  *
- * Changes:    
+ * Changes:
  *
  * -----------------------------------------------------------------------*/
 
 #include <math.h>
-#include "bncuploadcaster.h" 
+#include "bncuploadcaster.h"
 #include "bncversion.h"
 #include "bnccore.h"
@@ -27,5 +27,5 @@
 bncUploadCaster::bncUploadCaster(const QString& mountpoint,
                                  const QString& outHost, int outPort,
-                                 const QString& password, int iRow, 
+                                 const QString& password, int iRow,
                                  int rate) {
   _mountpoint    = mountpoint;
@@ -45,10 +45,10 @@
   _isToBeDeleted = false;
 
-  connect(this, SIGNAL(newMessage(QByteArray,bool)), 
+  connect(this, SIGNAL(newMessage(QByteArray,bool)),
           BNC_CORE, SLOT(slotMessage(const QByteArray,bool)));
 
   if (BNC_CORE->_uploadTableItems.find(_iRow) != BNC_CORE->_uploadTableItems.end()){
-    connect(this, SIGNAL(newBytes(QByteArray,double)), 
-            BNC_CORE->_uploadTableItems.value(iRow), 
+    connect(this, SIGNAL(newBytes(QByteArray,double)),
+            BNC_CORE->_uploadTableItems.value(iRow),
             SLOT(slotNewBytes(const QByteArray,double)));
   }
@@ -69,4 +69,7 @@
   if (isRunning()) {
     wait();
+  }
+  if (_outSocket) {
+    delete _outSocket;
   }
 }
@@ -111,5 +114,5 @@
   }
 
-  if (_outSocket != 0 && 
+  if (_outSocket != 0 &&
       _outSocket->state() == QAbstractSocket::ConnectedState) {
     return;
@@ -141,5 +144,5 @@
   }
 
-  QByteArray msg = "SOURCE " + _password.toAscii() + " /" + 
+  QByteArray msg = "SOURCE " + _password.toAscii() + " /" +
                    _mountpoint.toAscii() + "\r\n" +
                    "Source-Agent: NTRIP BNC/" BNCVERSION "\r\n\r\n";
