From: Daniel Stenberg Date: Sat, 31 Mar 2007 21:15:37 +0000 (+0000) Subject: fix a (minor) memory leak in case of error X-Git-Tag: curl-7_16_2~69 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dc2ea33e32ba9aeecdcd33c0541a9e33a85774ba;p=curl fix a (minor) memory leak in case of error CID 21 in the coverity.com scan --- 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);