aboutsummaryrefslogtreecommitdiff
path: root/lib/ftp.c
diff options
context:
space:
mode:
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;
}