Skip to content

Commit

Permalink
pop3_perform_authentication: fix memory leak
Browse files Browse the repository at this point in the history
Coverity CID 1215287. 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 a9beeee commit ea6c5f0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/pop3.c
Expand Up @@ -560,8 +560,6 @@ static CURLcode pop3_perform_authentication(struct connectdata *conn)
if(mech && (pop3c->preftype & POP3_TYPE_SASL)) {
/* Perform SASL based authentication */
result = pop3_perform_auth(conn, mech, initresp, len, state1, state2);

Curl_safefree(initresp);
}
#ifndef CURL_DISABLE_CRYPTO_AUTH
else if((pop3c->authtypes & POP3_TYPE_APOP) &&
Expand All @@ -580,6 +578,8 @@ static CURLcode pop3_perform_authentication(struct connectdata *conn)
}
}

Curl_safefree(initresp);

return result;
}

Expand Down

0 comments on commit ea6c5f0

Please sign in to comment.