diff --git a/servatrice/src/smtp/smtpclient.cpp b/servatrice/src/smtp/smtpclient.cpp index 37988871..f54d275b 100644 --- a/servatrice/src/smtp/smtpclient.cpp +++ b/servatrice/src/smtp/smtpclient.cpp @@ -25,6 +25,7 @@ /* [1] Constructors and destructors */ SmtpClient::SmtpClient(const QString & host, int port, ConnectionType connectionType) : + socket(NULL), name("localhost"), authMethod(AuthPlain), connectionTimeout(5000), @@ -44,7 +45,10 @@ SmtpClient::SmtpClient(const QString & host, int port, ConnectionType connection this, SLOT(socketReadyRead())); } -SmtpClient::~SmtpClient() {} +SmtpClient::~SmtpClient() { + if (socket) + delete socket; +} /* [1] --- */ @@ -80,6 +84,9 @@ void SmtpClient::setConnectionType(ConnectionType ct) { this->connectionType = ct; + if (socket) + delete socket; + switch (connectionType) { case TcpConnection: