From dc2ea33e32ba9aeecdcd33c0541a9e33a85774ba Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sat, 31 Mar 2007 21:15:37 +0000 Subject: fix a (minor) memory leak in case of error CID 21 in the coverity.com scan --- src/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/main.c') 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); -- cgit v1.2.3