aboutsummaryrefslogtreecommitdiff
path: root/lib/ftp.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2001-04-03 10:20:23 +0000
committerDaniel Stenberg <daniel@haxx.se>2001-04-03 10:20:23 +0000
commit28497e7ee40e8e2bf3c50f20c311bf9abff34ea6 (patch)
tree85bbe960cfe2dedad25122fab285a7d876ee55b1 /lib/ftp.c
parent87c7f403a9a6d1f57bc50a322ce506775ca25395 (diff)
better error checks for failure conditions (based on Puneet Pawaia's reports)
Diffstat (limited to 'lib/ftp.c')
-rw-r--r--lib/ftp.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/ftp.c b/lib/ftp.c
index 53f8df14e..701b497e6 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -1720,12 +1720,14 @@ CURLcode Curl_ftp_disconnect(struct connectdata *conn)
{
struct FTP *ftp= conn->proto.ftp;
- if(ftp->user)
- free(ftp->user);
- if(ftp->passwd)
- free(ftp->passwd);
- if(ftp->entrypath)
- free(ftp->entrypath);
-
+ /* The FTP session may or may not have been allocated/setup at this point! */
+ if(ftp) {
+ if(ftp->user)
+ free(ftp->user);
+ if(ftp->passwd)
+ free(ftp->passwd);
+ if(ftp->entrypath)
+ free(ftp->entrypath);
+ }
return CURLE_OK;
}