]> granicus.if.org Git - curl/commitdiff
Fixed a couple of out of memory leaks and a segfault in the IMAP code.
authorDan Fandrich <dan@coneharvesters.com>
Fri, 26 Feb 2010 21:24:44 +0000 (21:24 +0000)
committerDan Fandrich <dan@coneharvesters.com>
Fri, 26 Feb 2010 21:24:44 +0000 (21:24 +0000)
CHANGES
lib/imap.c

diff --git a/CHANGES b/CHANGES
index ae09307070cafd397d162b0b384ff40e8ac66fb9..35ed8848efdb730b80a20e1f55fd840f28b20520 100644 (file)
--- 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
index 2920a017723012c91b6c347216e70ff181fb30b7..09c7353449ba203fcc2d66aa6680a72d1f2503a7 100644 (file)
@@ -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;
 }