aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2009-11-19 17:21:56 +0000
committerYang Tse <yangsita@gmail.com>2009-11-19 17:21:56 +0000
commit5129442ee7074e24f097a389ddb789c9996bb42a (patch)
treef2e1013a6e3b923d2225563725af73c6e2b12005 /lib
parente8fd5d806204118c8f856378c911f467a43d0231 (diff)
Explicit initialization of all FTP struct members in ftp_init()
Diffstat (limited to 'lib')
-rw-r--r--lib/ftp.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/ftp.c b/lib/ftp.c
index ff2a828d3..b2cd13c8c 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -3089,16 +3089,20 @@ static CURLcode ftp_easy_statemach(struct connectdata *conn)
*/
static CURLcode ftp_init(struct connectdata *conn)
{
- struct SessionHandle *data = conn->data;
- struct FTP *ftp = data->state.proto.ftp;
- if(!ftp) {
- ftp = data->state.proto.ftp = calloc(1, sizeof(struct FTP));
- if(!ftp)
+ struct FTP *ftp;
+
+ if(NULL == conn->data->state.proto.ftp) {
+ conn->data->state.proto.ftp = malloc(sizeof(struct FTP));
+ if(NULL == conn->data->state.proto.ftp)
return CURLE_OUT_OF_MEMORY;
}
+ ftp = conn->data->state.proto.ftp;
+
/* get some initial data into the ftp struct */
- ftp->bytecountp = &data->req.bytecount;
+ ftp->bytecountp = &conn->data->req.bytecount;
+ ftp->transfer = FTPTRANSFER_BODY;
+ ftp->downloadsize = 0;
/* No need to duplicate user+password, the connectdata struct won't change
during a session, but we re-init them here since on subsequent inits