From 056edd8570a5a5042dd0cc616b8aad3c398379cc Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Wed, 15 Jul 2015 12:42:56 +0200 Subject: [PATCH 1/2] Merge memory leak fix for smtp client source: https://github.com/bluetiger9/SmtpClient-for-Qt/commit/c12f70b721a80dfbb fd4feb5c0f17ddef93d5a56 --- servatrice/src/smtp/smtpclient.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/servatrice/src/smtp/smtpclient.cpp b/servatrice/src/smtp/smtpclient.cpp index 37988871..79b7add1 100644 --- a/servatrice/src/smtp/smtpclient.cpp +++ b/servatrice/src/smtp/smtpclient.cpp @@ -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: From 5dc7c60b4d38a018622d0503c81ebbe0a0cf90e8 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Wed, 15 Jul 2015 15:17:23 +0200 Subject: [PATCH 2/2] reorder parameters --- servatrice/src/smtp/smtpclient.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/servatrice/src/smtp/smtpclient.cpp b/servatrice/src/smtp/smtpclient.cpp index 79b7add1..f54d275b 100644 --- a/servatrice/src/smtp/smtpclient.cpp +++ b/servatrice/src/smtp/smtpclient.cpp @@ -25,12 +25,12 @@ /* [1] Constructors and destructors */ SmtpClient::SmtpClient(const QString & host, int port, ConnectionType connectionType) : + socket(NULL), name("localhost"), authMethod(AuthPlain), connectionTimeout(5000), responseTimeout(5000), - sendMessageTimeout(60000), - socket(NULL) + sendMessageTimeout(60000) { setConnectionType(connectionType);