Commit 056edd85 authored by Fabio Bas's avatar Fabio Bas
Browse files

Merge memory leak fix for smtp client

source:
https://github.com/bluetiger9/SmtpClient-for-Qt/commit/c12f70b721a80dfbb
fd4feb5c0f17ddef93d5a56
parent 51d12f3e
...@@ -29,7 +29,8 @@ SmtpClient::SmtpClient(const QString & host, int port, ConnectionType connection ...@@ -29,7 +29,8 @@ SmtpClient::SmtpClient(const QString & host, int port, ConnectionType connection
authMethod(AuthPlain), authMethod(AuthPlain),
connectionTimeout(5000), connectionTimeout(5000),
responseTimeout(5000), responseTimeout(5000),
sendMessageTimeout(60000) sendMessageTimeout(60000),
socket(NULL)
{ {
setConnectionType(connectionType); setConnectionType(connectionType);
...@@ -44,7 +45,10 @@ SmtpClient::SmtpClient(const QString & host, int port, ConnectionType connection ...@@ -44,7 +45,10 @@ SmtpClient::SmtpClient(const QString & host, int port, ConnectionType connection
this, SLOT(socketReadyRead())); this, SLOT(socketReadyRead()));
} }
SmtpClient::~SmtpClient() {} SmtpClient::~SmtpClient() {
if (socket)
delete socket;
}
/* [1] --- */ /* [1] --- */
...@@ -80,6 +84,9 @@ void SmtpClient::setConnectionType(ConnectionType ct) ...@@ -80,6 +84,9 @@ void SmtpClient::setConnectionType(ConnectionType ct)
{ {
this->connectionType = ct; this->connectionType = ct;
if (socket)
delete socket;
switch (connectionType) switch (connectionType)
{ {
case TcpConnection: case TcpConnection:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment