1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 23:58:49 -05:00

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.
This commit is contained in:
Daniel Stenberg 2014-10-02 23:01:45 +02:00
parent a8ec986981
commit a9beeeeeea

View File

@ -634,8 +634,6 @@ static CURLcode imap_perform_authentication(struct connectdata *conn)
if(mech && (imapc->preftype & IMAP_TYPE_SASL)) { if(mech && (imapc->preftype & IMAP_TYPE_SASL)) {
/* Perform SASL based authentication */ /* Perform SASL based authentication */
result = imap_perform_authenticate(conn, mech, initresp, state1, state2); result = imap_perform_authenticate(conn, mech, initresp, state1, state2);
Curl_safefree(initresp);
} }
else if((!imapc->login_disabled) && else if((!imapc->login_disabled) &&
(imapc->preftype & IMAP_TYPE_CLEARTEXT)) (imapc->preftype & IMAP_TYPE_CLEARTEXT))
@ -648,6 +646,8 @@ static CURLcode imap_perform_authentication(struct connectdata *conn)
} }
} }
Curl_safefree(initresp);
return result; return result;
} }