diff options
author | Daniel Stenberg <daniel@haxx.se> | 2023-02-27 23:57:23 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2023-03-03 23:25:23 +0100 |
commit | 9c188e771c9d5ecbdb04cbc9f3936bb9f52f78c9 (patch) | |
tree | 8e80174942206e34a4d3b2d478847a537b5ecf3c /lib/transfer.c | |
parent | c84c0f9aa3bb0068bd6cbf6fce77bacccececa75 (diff) | |
download | curl-9c188e771c9d5ecbdb04cbc9f3936bb9f52f78c9.tar.gz |
ftp: allocate the wildcard struct on demand
The feature is rarely used so this frees up data for the vast majority
of easy handles that don't use it.
Rename "protdata" to "ftpwc" since it is always an FTP wildcard struct
pointer. Made the state struct field an unsigned char to save space.
Closes #10639
Diffstat (limited to 'lib/transfer.c')
-rw-r--r-- | lib/transfer.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/transfer.c b/lib/transfer.c index 27843f50c..140895113 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -1402,7 +1402,13 @@ CURLcode Curl_pretransfer(struct Curl_easy *data) #ifndef CURL_DISABLE_FTP data->state.wildcardmatch = data->set.wildcard_enabled; if(data->state.wildcardmatch) { - struct WildcardData *wc = &data->wildcard; + struct WildcardData *wc; + if(!data->wildcard) { + data->wildcard = calloc(1, sizeof(struct WildcardData)); + if(!data->wildcard) + return CURLE_OUT_OF_MEMORY; + } + wc = data->wildcard; if(wc->state < CURLWC_INIT) { result = Curl_wildcard_init(wc); /* init wildcard structures */ if(result) |