#217 Fixed memory leak

This commit is contained in:
Vincent Richard 2019-07-02 23:26:29 +02:00
parent e2fc1911f1
commit 8f4db13e7f

View File

@ -341,11 +341,12 @@ void SMTPConnection::authenticate() {
const string password = getAuthenticator()->getPassword(); const string password = getAuthenticator()->getPassword();
const string authToken = username + '\0' + username + '\0' + password; const string authToken = username + '\0' + username + '\0' + password;
auto encoder = new vmime::utility::encoder::b64Encoder();
utility::inputStreamStringAdapter in(authToken); utility::inputStreamStringAdapter in(authToken);
string authTokenBase64; string authTokenBase64;
utility::outputStreamStringAdapter out(authTokenBase64); utility::outputStreamStringAdapter out(authTokenBase64);
encoder->encode(in, out);
vmime::utility::encoder::b64Encoder encoder;
encoder.encode(in, out);
sendRequest(SMTPCommand::AUTH(plain, authTokenBase64)); sendRequest(SMTPCommand::AUTH(plain, authTokenBase64));