David Byron found a problem multiple -d options when libcurl was built with

--enable-debug, as then curl used free() on memory allocated both with
normal malloc() and with libcurl-provided functions, when the latter MUST be
freed with curl_free() in debug builds.
This commit is contained in:
Daniel Stenberg 2006-03-27 21:59:40 +00:00
parent d74725ce67
commit f17d9bba14
3 changed files with 14 additions and 2 deletions

View file

@ -1892,7 +1892,11 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
/* we already have a string, we append this one
with a separating &-letter */
char *oldpost=config->postfields;
config->postfields=aprintf("%s&%s", oldpost, postdata);
size_t newlen = strlen(oldpost) + strlen(postdata) + 2;
config->postfields=malloc(newlen);
if(!config->postfields)
return PARAM_NO_MEM;
snprintf(config->postfields, newlen, "%s&%s", oldpost, postdata);
free(oldpost);
free(postdata);
}