Curl_http_body: cleanup properly when Curl_getformdata errors

Reported-by: yushicheng7788 on github
Based-on-work-by: yushicheng7788 on github
Fixes #12410
Closes #12421
This commit is contained in:
Daniel Stenberg 2023-11-28 15:49:49 +08:00
parent 0ca3a4ec9a
commit 34e319954a
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -2439,8 +2439,10 @@ CURLcode Curl_http_body(struct Curl_easy *data, struct connectdata *conn,
Curl_mime_cleanpart(data->state.formp);
result = Curl_getformdata(data, data->state.formp, data->set.httppost,
data->state.fread_func);
if(result)
if(result) {
Curl_safefree(data->state.formp);
return result;
}
data->state.mimepost = data->state.formp;
}
break;