aboutsummaryrefslogtreecommitdiff
path: root/lib/ftp.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2003-10-24 12:58:59 +0000
committerDaniel Stenberg <daniel@haxx.se>2003-10-24 12:58:59 +0000
commit656d4b4c20bfd938ff6f0ce6ee5a84a50d7d3e76 (patch)
tree0b7dfb0830a95a9925a91c3160790d78177b120d /lib/ftp.c
parent7247041e219c0281b9ff0835eada711593b9d62f (diff)
if malloc fails, we must bail out nicely
Diffstat (limited to 'lib/ftp.c')
-rw-r--r--lib/ftp.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/ftp.c b/lib/ftp.c
index 4080af081..cbbd93267 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -558,6 +558,9 @@ CURLcode Curl_ftp_connect(struct connectdata *conn)
char *dir = (char *)malloc(nread+1);
char *store=dir;
char *ptr=&buf[4]; /* start on the first letter */
+
+ if(!dir)
+ return CURLE_OUT_OF_MEMORY;
/* Reply format is like
257<space>"<directory-name>"<space><commentary> and the RFC959 says
@@ -565,7 +568,7 @@ CURLcode Curl_ftp_connect(struct connectdata *conn)
The directory name can contain any character; embedded double-quotes
should be escaped by double-quotes (the "quote-doubling" convention).
*/
- if(dir && ('\"' == *ptr)) {
+ if('\"' == *ptr) {
/* it started good */
ptr++;
while(ptr && *ptr) {