From: Dan Fandrich Date: Fri, 26 Feb 2010 21:24:44 +0000 (+0000) Subject: Fixed a couple of out of memory leaks and a segfault in the IMAP code. X-Git-Tag: curl-7_20_1~129 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=507d58435a518e23477c6cd6f655c122bde8b4ac;p=thirdparty%2Fcurl.git Fixed a couple of out of memory leaks and a segfault in the IMAP code. --- diff --git a/CHANGES b/CHANGES index ae09307070..35ed8848ef 100644 --- a/CHANGES +++ b/CHANGES @@ -7,7 +7,7 @@ Changelog Daniel Fandrich (25 Feb 2010) -- Fixed a couple of out of memory leaks and a segfault in the SMTP code. +- Fixed a couple of out of memory leaks and a segfault in the SMTP & IMAP code. Yang Tse (25 Feb 2010) - I fixed bug report #2958074 indicating diff --git a/lib/imap.c b/lib/imap.c index 2920a01772..09c7353449 100644 --- a/lib/imap.c +++ b/lib/imap.c @@ -885,11 +885,12 @@ static CURLcode imap_disconnect(struct connectdata *conn) /* The IMAP session may or may not have been allocated/setup at this point! */ - (void)imap_logout(conn); /* ignore errors on the LOGOUT */ + if (imapc->pp.conn) + (void)imap_logout(conn); /* ignore errors on the LOGOUT */ Curl_pp_disconnect(&imapc->pp); - free(imapc->mailbox); + Curl_safefree(imapc->mailbox); return CURLE_OK; } @@ -914,6 +915,8 @@ static CURLcode imap_parse_url_path(struct connectdata *conn) /* url decode the path and use this mailbox */ imapc->mailbox = curl_easy_unescape(data, path, 0, &len); + if(!imapc->mailbox) + return CURLE_OUT_OF_MEMORY; return CURLE_OK; }