mirror of
https://github.com/curl/curl.git
synced 2024-11-21 01:16:58 +08:00
formpost: trying to attach a directory no longer crashes
The error path would previously add a freed entry to the linked list. Reported-by: Toby Peterson Fixes #1053
This commit is contained in:
parent
54e48b14e1
commit
bdf162af25
@ -863,13 +863,6 @@ static CURLcode AddFormData(struct FormData **formp,
|
||||
|
||||
newform->type = type;
|
||||
|
||||
if(*formp) {
|
||||
(*formp)->next = newform;
|
||||
*formp = newform;
|
||||
}
|
||||
else
|
||||
*formp = newform;
|
||||
|
||||
if(size) {
|
||||
if(type != FORM_FILE)
|
||||
/* for static content as well as callback data we add the size given
|
||||
@ -889,6 +882,14 @@ static CURLcode AddFormData(struct FormData **formp,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(*formp) {
|
||||
(*formp)->next = newform;
|
||||
*formp = newform;
|
||||
}
|
||||
else
|
||||
*formp = newform;
|
||||
|
||||
return CURLE_OK;
|
||||
error:
|
||||
if(newform)
|
||||
|
Loading…
Reference in New Issue
Block a user