In the errorpath for randstr being too long to copy into the buffer
we leak the randstr when returning CURLE_FAILED_INIT. Fix by using
an explicit free on randstr in the errorpath.
Closes: #13602
Reviewed-by: Daniel Stenberg <daniel@haxx.se>
if(result)
return result;
DEBUGASSERT(randlen < sizeof(keyval));
- if(randlen >= sizeof(keyval))
+ if(randlen >= sizeof(keyval)) {
+ free(randstr);
return CURLE_FAILED_INIT;
+ }
strcpy(keyval, randstr);
free(randstr);
for(i = 0; !result && (i < sizeof(heads)/sizeof(heads[0])); i++) {