I did this
I use CURLOPT_HTTPPOST to send files, but curl crashed. I think it is caused by the following part of the code.
/* Convert the form structure into a mime structure, then keep
the conversion */
if(!data->state.formp) {
data->state.formp = calloc(sizeof(curl_mimepart), 1);
if(!data->state.formp)
return CURLE_OUT_OF_MEMORY;
Curl_mime_cleanpart(data->state.formp);
result = Curl_getformdata(data, data->state.formp, data->set.httppost,
data->state.fread_func, data->state.seek_func);
if(result)
return result;
data->state.mimepost = data->state.formp;
}
If Curl_getformdata() returns any error, which will cause data->state.mimepost = data->state.formp; not executed. But if I sent this request again, data->state.formp is not NULL, and data->state.mimepost is NULL, which cause a crash. Is there any optimization method in this case?
I expected the following
Curl will not crash in this case.
curl/libcurl version
8.4.0
operating system
MacOS
I did this
I use CURLOPT_HTTPPOST to send files, but curl crashed. I think it is caused by the following part of the code.
If Curl_getformdata() returns any error, which will cause data->state.mimepost = data->state.formp; not executed. But if I sent this request again, data->state.formp is not NULL, and data->state.mimepost is NULL, which cause a crash. Is there any optimization method in this case?
I expected the following
Curl will not crash in this case.
curl/libcurl version
8.4.0
operating system
MacOS