aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2008-10-19 21:00:40 +0000
committerDaniel Stenberg <daniel@haxx.se>2008-10-19 21:00:40 +0000
commit2688cf343bdcab56c781e1932c42aadea7bacb39 (patch)
treef6128d3d110241a5fb84ba806f5e0c0a6182f370
parentb416b87518491ce60f76cbae29888054e6cd2596 (diff)
Fixed potential memory leak in OOM situations. Detected by coverity.com
-rw-r--r--src/main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index 8212c028f..3c248a581 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2313,6 +2313,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
}
else {
char *enc = curl_easy_escape(config->easy, postdata, size);
+ free(postdata); /* no matter if it worked or not */
if(enc) {
/* now make a string with the name from above and append the
encoded string */
@@ -2325,7 +2326,6 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
else
strcpy(n, enc);
curl_free(enc);
- free(postdata);
if(n) {
postdata = n;
}