diff options
author | Dan Fandrich <dan@coneharvesters.com> | 2007-10-30 23:00:40 +0000 |
---|---|---|
committer | Dan Fandrich <dan@coneharvesters.com> | 2007-10-30 23:00:40 +0000 |
commit | 59b05ac383f45ac3fe2e9fba899b440def9da2bd (patch) | |
tree | fcfb95fbe79dbfee28382f65147e6108350773c2 /lib/file.c | |
parent | 9b15f1be2649da787d9ebdf4a65a973523acbbbe (diff) |
Fixed an OOM problem with file: URLs
Moved Curl_file_connect into the protocol handler struct.
Diffstat (limited to 'lib/file.c')
-rw-r--r-- | lib/file.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/file.c b/lib/file.c index 0bc0e4942..f344404db 100644 --- a/lib/file.c +++ b/lib/file.c @@ -97,6 +97,7 @@ static CURLcode Curl_file(struct connectdata *, bool *done); static CURLcode Curl_file_done(struct connectdata *conn, CURLcode status, bool premature); +static CURLcode Curl_file_connect(struct connectdata *conn, bool *done); /* * FILE scheme handler. @@ -108,7 +109,7 @@ const struct Curl_handler Curl_handler_file = { Curl_file, /* do_it */ Curl_file_done, /* done */ ZERO_NULL, /* do_more */ - ZERO_NULL, /* connect_it */ + Curl_file_connect, /* connect_it */ ZERO_NULL, /* connecting */ ZERO_NULL, /* doing */ ZERO_NULL, /* proto_getsock */ @@ -123,7 +124,7 @@ const struct Curl_handler Curl_handler_file = { * do protocol-specific actions at connect-time. We emulate a * connect-then-transfer protocol and "connect" to the file here */ -CURLcode Curl_file_connect(struct connectdata *conn) +static CURLcode Curl_file_connect(struct connectdata *conn, bool *done) { struct SessionHandle *data = conn->data; char *real_path = curl_easy_unescape(data, data->reqdata.path, 0, NULL); @@ -203,6 +204,7 @@ CURLcode Curl_file_connect(struct connectdata *conn) Curl_file_done(conn, CURLE_FILE_COULDNT_READ_FILE, FALSE); return CURLE_FILE_COULDNT_READ_FILE; } + *done = TRUE; return CURLE_OK; } @@ -218,9 +220,6 @@ static CURLcode Curl_file_done(struct connectdata *conn, if(file->fd != -1) close(file->fd); - free(file); - conn->data->reqdata.proto.file= NULL; /* clear it! */ - return CURLE_OK; } |