1
0
mirror of https://github.com/moparisthebest/curl synced 2025-01-08 12:28:06 -05:00

Fix an OOM handling problem

This commit is contained in:
Yang Tse 2009-10-14 18:11:36 +00:00
parent 6daede08cb
commit b4af26a188

View File

@ -2360,18 +2360,16 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
encoded string */
size_t outlen = nlen + strlen(enc) + 2;
char *n = malloc(outlen);
if(!n)
if(!n) {
curl_free(enc);
return PARAM_NO_MEM;
}
if (nlen > 0) /* only append '=' if we have a name */
snprintf(n, outlen, "%.*s=%s", nlen, nextarg, enc);
else
strcpy(n, enc);
curl_free(enc);
if(n) {
postdata = n;
}
else
return PARAM_NO_MEM;
postdata = n;
}
else
return PARAM_NO_MEM;