Skip to content

Commit

Permalink
imap_perform_authentication: fix memory leak
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bagder committed Oct 2, 2014
1 parent a8ec986 commit a9beeee
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/imap.c
Expand Up @@ -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))
Expand All @@ -648,6 +646,8 @@ static CURLcode imap_perform_authentication(struct connectdata *conn)
}
}

Curl_safefree(initresp);

return result;
}

Expand Down

0 comments on commit a9beeee

Please sign in to comment.