]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
setopt: clear mimepost when formp is freed
authorDaniel Stenberg <daniel@haxx.se>
Tue, 2 Jan 2024 15:35:50 +0000 (16:35 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 2 Jan 2024 22:32:43 +0000 (23:32 +0100)
A precaution to avoid a possibly dangling pointer left behind.

Reported-by: Thomas Ferguson
Fixes #12608
Closes #12621

lib/setopt.c

index 460cb32e74a2c4074e9d1ddbb1466adca3a3adc1..e13432334d9a04261d81922155b0819d30643057 100644 (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;