aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2010-02-26 21:24:44 +0000
committerDan Fandrich <dan@coneharvesters.com>2010-02-26 21:24:44 +0000
commit507d58435a518e23477c6cd6f655c122bde8b4ac (patch)
treec7a22cc7d0b0ad99d6054f37252fb08c18e3a2c4 /lib
parentdc21a5e5a153025faac59d157e0a87b78ffb8281 (diff)
Fixed a couple of out of memory leaks and a segfault in the IMAP code.
Diffstat (limited to 'lib')
-rw-r--r--lib/imap.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/imap.c b/lib/imap.c
index 2920a0177..09c735344 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;
}