ftp wildcard: segfault due to init only in multi_perform

The proper FTP wildcard init is now more properly done in Curl_pretransfer()
and the corresponding cleanup in Curl_close().

The previous place of init/cleanup code made the internal pointer to be NULL
when this feature was used with the multi_socket() API, as it was made within
the curl_multi_perform() function.

Reported-by: Jonathan Cardoso Machado
Fixes #800
This commit is contained in:
Daniel Stenberg 2016-05-15 00:37:36 +02:00
parent e1372418cd
commit cba9621342
3 changed files with 16 additions and 15 deletions

View file

@ -1385,6 +1385,16 @@ CURLcode Curl_pretransfer(struct SessionHandle *data)
consider to be fine */
data->state.authhost.picked &= data->state.authhost.want;
data->state.authproxy.picked &= data->state.authproxy.want;
if(data->set.wildcardmatch) {
struct WildcardData *wc = &data->wildcard;
if(!wc->filelist) {
result = Curl_wildcard_init(wc); /* init wildcard structures */
if(result)
return CURLM_OUT_OF_MEMORY;
}
}
}
return result;