aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2013-02-10 20:32:36 +0000
committerSteve Holme <steve_holme@hotmail.com>2013-02-10 20:32:36 +0000
commit18d1ea45282508825b74ebf6704db812797e553a (patch)
treecd6079ff583347d0f4adace6b5cde4bd42d4fee5
parent566a3638fa368f0cc9f54d305a24b9c6e4bb9120 (diff)
imap: Fixed memory leak following commit f6010d9a0359
-rw-r--r--lib/imap.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/imap.c b/lib/imap.c
index 8032db4a0..be0de2eed 100644
--- a/lib/imap.c
+++ b/lib/imap.c
@@ -497,8 +497,8 @@ static CURLcode imap_state_login(struct connectdata *conn)
{
CURLcode result = CURLE_OK;
struct FTP *imap = conn->data->state.proto.imap;
- char *user = imap_atom(imap->user);
- char *passwd = imap_atom(imap->passwd);
+ char *user;
+ char *passwd;
/* Check we have a username and password to authenticate with and end the
connect phase if we don't */
@@ -508,6 +508,10 @@ static CURLcode imap_state_login(struct connectdata *conn)
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 */
result = imap_sendf(conn, "LOGIN %s %s", user ? user : "",
passwd ? passwd : "");