]> granicus.if.org Git - curl/commitdiff
mime: be tolerant about setting twice the same header list in a part.
authorPatrick Monnerat <patrick@monnerat.net>
Sun, 8 Oct 2017 15:20:13 +0000 (16:20 +0100)
committerPatrick Monnerat <patrick@monnerat.net>
Sun, 8 Oct 2017 15:20:13 +0000 (16:20 +0100)
lib/mime.c

index 496f5e6fb253fbed489d4fb734b759f422b77d21..7cfce6ae826a176dc07d6486361a308a0dba5355 100644 (file)
@@ -1356,7 +1356,8 @@ CURLcode curl_mime_headers(curl_mimepart *part,
     return CURLE_BAD_FUNCTION_ARGUMENT;
 
   if(part->flags & MIME_USERHEADERS_OWNER) {
-    curl_slist_free_all(part->userheaders);
+    if(part->userheaders != headers)  /* Allow setting twice the same list. */
+      curl_slist_free_all(part->userheaders);
     part->flags &= ~MIME_USERHEADERS_OWNER;
   }
   part->userheaders = headers;