altsvc: free 'as' when returning error

Closes #12570

Signed-off-by: zengwei <zengwei1@uniontech.com>
This commit is contained in:
zengwei2000 2023-12-21 02:09:21 +00:00 committed by Daniel Stenberg
parent 95a882d268
commit 8d23a40ba6
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -106,9 +106,11 @@ static struct altsvc *altsvc_createid(const char *srchost,
dlen = strlen(dsthost); dlen = strlen(dsthost);
DEBUGASSERT(hlen); DEBUGASSERT(hlen);
DEBUGASSERT(dlen); DEBUGASSERT(dlen);
if(!hlen || !dlen) if(!hlen || !dlen) {
/* bad input */ /* bad input */
free(as);
return NULL; return NULL;
}
if((hlen > 2) && srchost[0] == '[') { if((hlen > 2) && srchost[0] == '[') {
/* IPv6 address, strip off brackets */ /* IPv6 address, strip off brackets */
srchost++; srchost++;