1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

imap: Fixed memory leak following commit f6010d9a03

This commit is contained in:
Steve Holme 2013-02-10 20:32:36 +00:00
parent 566a3638fa
commit 18d1ea4528

View File

@ -497,8 +497,8 @@ static CURLcode imap_state_login(struct connectdata *conn)
{ {
CURLcode result = CURLE_OK; CURLcode result = CURLE_OK;
struct FTP *imap = conn->data->state.proto.imap; struct FTP *imap = conn->data->state.proto.imap;
char *user = imap_atom(imap->user); char *user;
char *passwd = imap_atom(imap->passwd); char *passwd;
/* Check we have a username and password to authenticate with and end the /* Check we have a username and password to authenticate with and end the
connect phase if we don't */ connect phase if we don't */
@ -508,6 +508,10 @@ static CURLcode imap_state_login(struct connectdata *conn)
return result; return result;
} }
/* Make sure the username and password are in the correct atom format */
user = imap_atom(imap->user);
passwd = imap_atom(imap->passwd);
/* Send USER and password */ /* Send USER and password */
result = imap_sendf(conn, "LOGIN %s %s", user ? user : "", result = imap_sendf(conn, "LOGIN %s %s", user ? user : "",
passwd ? passwd : ""); passwd ? passwd : "");