setopt: clear mimepost when formp is freed

A precaution to avoid a possibly dangling pointer left behind.

Reported-by: Thomas Ferguson
Fixes #12608
Closes #12621
This commit is contained in:
Daniel Stenberg 2024-01-02 16:35:50 +01:00
parent bf7cd837a6
commit eeda18b1d2
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -681,6 +681,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
data->set.opt_no_body = FALSE; /* this is implied */
Curl_mime_cleanpart(data->state.formp);
Curl_safefree(data->state.formp);
data->state.mimepost = NULL;
break;
#endif
@ -988,6 +989,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
#ifndef CURL_DISABLE_FORM_API
Curl_mime_cleanpart(data->state.formp);
Curl_safefree(data->state.formp);
data->state.mimepost = NULL;
#endif
}
break;