]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
altsvc: free 'as' when returning error
authorzengwei2000 <102871671+zengwei2000@users.noreply.github.com>
Thu, 21 Dec 2023 02:09:21 +0000 (02:09 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 21 Dec 2023 08:15:19 +0000 (09:15 +0100)
Closes #12570

Signed-off-by: zengwei <zengwei1@uniontech.com>
lib/altsvc.c

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