aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2007-03-31 21:15:37 +0000
committerDaniel Stenberg <daniel@haxx.se>2007-03-31 21:15:37 +0000
commitdc2ea33e32ba9aeecdcd33c0541a9e33a85774ba (patch)
tree1796ca6b675d8542dc786052694386ac055f05a4 /src/main.c
parentc1f117700ac3dcca2bb6e3e8cde4535d4a6ad1de (diff)
fix a (minor) memory leak in case of error
CID 21 in the coverity.com scan
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index b4b3bfd8d..cfec4a307 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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);