From eeda18b1d2511cb9716066e5b29d81556a4f1355 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 2 Jan 2024 16:35:50 +0100 Subject: [PATCH] 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 --- lib/setopt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/setopt.c b/lib/setopt.c index 460cb32e74..e13432334d 100644 --- a/lib/setopt.c +++ b/lib/setopt.c @@ -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; -- 2.47.3