aboutsummaryrefslogtreecommitdiff
path: root/lib/imap.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2014-10-02 23:01:45 +0200
committerDaniel Stenberg <daniel@haxx.se>2014-10-02 23:01:45 +0200
commita9beeeeeeac018157412e4510342554a48df54f4 (patch)
tree2373d3ae08d8081021e829b75adc2c9a7a3c659b /lib/imap.c
parenta8ec986981d6a218ce3abac27b9e0b0e76286863 (diff)
imap_perform_authentication: fix memory leak
Coverity CID 1215296. There's a potential risk for a memory leak in here, and moving the free call to be unconditional seems like a cheap price to remove the risk.
Diffstat (limited to 'lib/imap.c')
-rw-r--r--lib/imap.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/imap.c b/lib/imap.c
index 9fc472866..ee1bad295 100644
--- a/lib/imap.c
+++ b/lib/imap.c
@@ -634,8 +634,6 @@ static CURLcode imap_perform_authentication(struct connectdata *conn)
if(mech && (imapc->preftype & IMAP_TYPE_SASL)) {
/* Perform SASL based authentication */
result = imap_perform_authenticate(conn, mech, initresp, state1, state2);
-
- Curl_safefree(initresp);
}
else if((!imapc->login_disabled) &&
(imapc->preftype & IMAP_TYPE_CLEARTEXT))
@@ -648,6 +646,8 @@ static CURLcode imap_perform_authentication(struct connectdata *conn)
}
}
+ Curl_safefree(initresp);
+
return result;
}