Fix memory leak

This commit is contained in:
Attila Tőkés 2015-06-03 23:27:54 +03:00
parent 6877ac8148
commit c12f70b721

View File

@ -29,7 +29,8 @@ SmtpClient::SmtpClient(const QString & host, int port, ConnectionType connection
authMethod(AuthPlain),
connectionTimeout(5000),
responseTimeout(5000),
sendMessageTimeout(60000)
sendMessageTimeout(60000),
socket(NULL)
{
setConnectionType(connectionType);
@ -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: