mirror of
https://github.com/curl/curl.git
synced 2025-04-12 16:20:35 +08:00
fix a (minor) memory leak in case of error
CID 21 in the coverity.com scan
This commit is contained in:
parent
c1f117700a
commit
dc2ea33e32
@ -2052,8 +2052,10 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
|
||||
char *oldpost=config->postfields;
|
||||
size_t newlen = strlen(oldpost) + strlen(postdata) + 2;
|
||||
config->postfields=malloc(newlen);
|
||||
if(!config->postfields)
|
||||
if(!config->postfields) {
|
||||
free(postdata);
|
||||
return PARAM_NO_MEM;
|
||||
}
|
||||
/* use ASCII value 0x26 for '&' to accommodate non-ASCII platforms */
|
||||
snprintf(config->postfields, newlen, "%s\x26%s", oldpost, postdata);
|
||||
free(oldpost);
|
||||
|
Loading…
x
Reference in New Issue
Block a user