X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=lib%2Fformdata.c;h=9e8ce4ea0ac89fc0a8c61b5bcf58bfd926a07043;hb=31368b6eac8092a307849518e912b4c475c0238a;hp=73d3b6d7240e5e1396c0f58ce6453acc70298d20;hpb=ff9f0eb35d80c251e9a54162eae18f44349ae59d;p=platform%2Fupstream%2Fcurl.git diff --git a/lib/formdata.c b/lib/formdata.c index 73d3b6d..9e8ce4e 100644 --- a/lib/formdata.c +++ b/lib/formdata.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2014, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2015, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -34,14 +34,12 @@ #include "formdata.h" #include "vtls/vtls.h" #include "strequal.h" -#include "curl_memory.h" #include "sendf.h" #include "strdup.h" +#include "curl_printf.h" -#define _MPRINTF_REPLACE /* use our functions only */ -#include - -/* The last #include file should be: */ +/* The last #include files should be: */ +#include "curl_memory.h" #include "memdebug.h" #ifndef HAVE_BASENAME @@ -417,7 +415,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost, else { form = AddFormInfo(fname, NULL, current_form); if(!form) { - Curl_safefree(fname); + free(fname); return_value = CURL_FORMADD_MEMORY; } else { @@ -506,7 +504,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost, else { form = AddFormInfo(NULL, type, current_form); if(!form) { - Curl_safefree(type); + free(type); return_value = CURL_FORMADD_MEMORY; } else { @@ -713,7 +711,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost, now by the httppost linked list */ while(first_form) { FormInfo *ptr = first_form->more; - Curl_safefree(first_form); + free(first_form); first_form = ptr; } @@ -758,7 +756,7 @@ curl_off_t VmsRealFileSize(const char * name, int ret_stat; FILE * file; - file = fopen(name, "r"); + file = fopen(name, "r"); /* VMS */ if(file == NULL) return 0; @@ -971,19 +969,16 @@ void curl_formfree(struct curl_httppost *form) next=form->next; /* the following form line */ /* recurse to sub-contents */ - if(form->more) - curl_formfree(form->more); + curl_formfree(form->more); - if(!(form->flags & HTTPPOST_PTRNAME) && form->name) + if(!(form->flags & HTTPPOST_PTRNAME)) free(form->name); /* free the name */ if(!(form->flags & - (HTTPPOST_PTRCONTENTS|HTTPPOST_BUFFER|HTTPPOST_CALLBACK)) && - form->contents) + (HTTPPOST_PTRCONTENTS|HTTPPOST_BUFFER|HTTPPOST_CALLBACK)) + ) free(form->contents); /* free the contents */ - if(form->contenttype) - free(form->contenttype); /* free the content type */ - if(form->showfilename) - free(form->showfilename); /* free the faked file name */ + free(form->contenttype); /* free the content type */ + free(form->showfilename); /* free the faked file name */ free(form); /* free the struct */ } while((form = next) != NULL); /* continue */ @@ -1073,7 +1068,7 @@ static CURLcode formdata_add_filename(const struct curl_httppost *file, /* filename need be escaped */ filename_escaped = malloc(strlen(filename)*2+1); if(!filename_escaped) { - Curl_safefree(filebasename); + free(filebasename); return CURLE_OUT_OF_MEMORY; } p0 = filename_escaped; @@ -1089,8 +1084,8 @@ static CURLcode formdata_add_filename(const struct curl_httppost *file, result = AddFormDataf(form, size, "; filename=\"%s\"", filename); - Curl_safefree(filename_escaped); - Curl_safefree(filebasename); + free(filename_escaped); + free(filebasename); return result; } @@ -1140,7 +1135,7 @@ CURLcode Curl_getformdata(struct SessionHandle *data, boundary); if(result) { - Curl_safefree(boundary); + free(boundary); return result; } /* we DO NOT include that line in the total size of the POST, since it'll be @@ -1183,7 +1178,7 @@ CURLcode Curl_getformdata(struct SessionHandle *data, /* If used, this is a link to more file names, we must then do the magic to include several files with the same field name */ - Curl_safefree(fileboundary); + free(fileboundary); fileboundary = formboundary(data); if(!fileboundary) { result = CURLE_OUT_OF_MEMORY; @@ -1336,15 +1331,15 @@ CURLcode Curl_getformdata(struct SessionHandle *data, if(result) { Curl_formclean(&firstform); - Curl_safefree(fileboundary); - Curl_safefree(boundary); + free(fileboundary); + free(boundary); return result; } *sizep = size; - Curl_safefree(fileboundary); - Curl_safefree(boundary); + free(fileboundary); + free(boundary); *finalform = firstform; @@ -1390,7 +1385,7 @@ static FILE * vmsfopenread(const char *file, const char *mode) { case FAB$C_VAR: case FAB$C_VFC: case FAB$C_STMCR: - return fopen(file, "r"); + return fopen(file, "r"); /* VMS */ break; default: return fopen(file, "r", "rfm=stmlf", "ctx=stm");