aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2000-11-17 14:06:24 +0000
committerDaniel Stenberg <daniel@haxx.se>2000-11-17 14:06:24 +0000
commitc0936824d4d45c4cdbaef180b21f87a0ea824120 (patch)
tree7c08a531836737df18d01b9eaf5cfcda0e6354f4
parent57ddd7e9287992a44bb30d0cc3e86e4d0f948a86 (diff)
added curl_formfree()
-rw-r--r--lib/formdata.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/lib/formdata.c b/lib/formdata.c
index 1e15f3ce4..cee0b0b0e 100644
--- a/lib/formdata.c
+++ b/lib/formdata.c
@@ -382,8 +382,8 @@ char *MakeFormBoundary(void)
return retstring;
}
-
+/* Used from http.c */
void FormFree(struct FormData *form)
{
struct FormData *next;
@@ -391,6 +391,28 @@ void FormFree(struct FormData *form)
next=form->next; /* the following form line */
free(form->line); /* free the line */
free(form); /* free the struct */
+
+ } while((form=next)); /* continue */
+}
+
+/* external function to free up a whole form post chain */
+void curl_formfree(struct HttpPost *form)
+{
+ struct HttpPost *next;
+ do {
+ next=form->next; /* the following form line */
+
+ /* recurse to sub-contents */
+ if(form->more)
+ curl_formfree(form->more);
+
+ if(form->name)
+ free(form->name); /* free the name */
+ if(form->contents)
+ free(form->contents); /* free the contents */
+ if(form->contenttype)
+ free(form->contenttype); /* free the content type */
+ free(form); /* free the struct */
} while((form=next)); /* continue */
}