From 5fc59c0863707014ab4df27a745251ebb21cd6a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Attila=20T=C5=91k=C3=A9s?= Date: Thu, 1 Jun 2017 19:14:20 +0300 Subject: [PATCH] Issue #50 - fix memory leaks --- src/mimemessage.cpp | 3 +++ src/smtpclient.cpp | 1 + 2 files changed, 4 insertions(+) diff --git a/src/mimemessage.cpp b/src/mimemessage.cpp index ea57cf4..bb64906 100644 --- a/src/mimemessage.cpp +++ b/src/mimemessage.cpp @@ -61,6 +61,7 @@ void MimeMessage::setContent(MimePart *content) { void MimeMessage::setSender(EmailAddress* e) { this->sender = e; + e->setParent(this); } void MimeMessage::addRecipient(EmailAddress* rcpt, RecipientType type) @@ -77,6 +78,8 @@ void MimeMessage::addRecipient(EmailAddress* rcpt, RecipientType type) recipientsBcc << rcpt; break; } + + rcpt->setParent(this); } void MimeMessage::addTo(EmailAddress* rcpt) { diff --git a/src/smtpclient.cpp b/src/smtpclient.cpp index 43b6741..afa4e87 100644 --- a/src/smtpclient.cpp +++ b/src/smtpclient.cpp @@ -364,6 +364,7 @@ bool SmtpClient::sendMail(MimeMessage& email) // To (primary recipients) for (it = email.getRecipients().begin(), itEnd = email.getRecipients().end(); it != itEnd; ++it) + { sendMessage("RCPT TO:<" + (*it)->getAddress() + ">"); waitForResponse();