summaryrefslogtreecommitdiffstats
path: root/lib/mime.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mime.c')
-rw-r--r--lib/mime.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/mime.c b/lib/mime.c
index 0a57e1e..842b2da 100644
--- a/lib/mime.c
+++ b/lib/mime.c
@@ -1167,14 +1167,16 @@ static void mime_subparts_unbind(void *ptr)
void Curl_mime_cleanpart(curl_mimepart *part)
{
- cleanup_part_content(part);
- curl_slist_free_all(part->curlheaders);
- if(part->flags & MIME_USERHEADERS_OWNER)
- curl_slist_free_all(part->userheaders);
- Curl_safefree(part->mimetype);
- Curl_safefree(part->name);
- Curl_safefree(part->filename);
- Curl_mime_initpart(part);
+ if(part) {
+ cleanup_part_content(part);
+ curl_slist_free_all(part->curlheaders);
+ if(part->flags & MIME_USERHEADERS_OWNER)
+ curl_slist_free_all(part->userheaders);
+ Curl_safefree(part->mimetype);
+ Curl_safefree(part->name);
+ Curl_safefree(part->filename);
+ Curl_mime_initpart(part);
+ }
}
/* Recursively delete a mime handle and its parts. */