diff options
author | Yang Tse <yangsita@gmail.com> | 2009-10-14 18:11:36 +0000 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2009-10-14 18:11:36 +0000 |
commit | b4af26a188477e2dd93d5ae21e88588a9028f176 (patch) | |
tree | 318b9be77480e790a8908583e0e46a304b13f222 /src | |
parent | 6daede08cb3ad27095cf9d41ac9f8761970bcb3a (diff) |
Fix an OOM handling problem
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/main.c b/src/main.c index cbe3ee5fe..16c3ed532 100644 --- a/src/main.c +++ b/src/main.c @@ -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; |