]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
internal_parse_url: fix memory leak
authorNikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
Mon, 16 Nov 2020 22:10:48 +0000 (23:10 +0100)
committerNikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
Tue, 17 Nov 2020 12:57:49 +0000 (13:57 +0100)
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
http.c

diff --git a/http.c b/http.c
index 39310289e5141c3da3167d5dd1f6aae58bdadc9a..ace81e0ba132adb36ee62aa97f8be5d35b36b0a7 100644 (file)
--- a/http.c
+++ b/http.c
@@ -763,8 +763,10 @@ int internal_parse_url(const char *url, char **res_proto, char **res_host,
                if (!*end) {
                        *port_str = 0;
                        port = new_port;
-                       if (port <= 0 || port > 0xffff)
+                       if (port <= 0 || port > 0xffff) {
+                               free(host);
                                return -EINVAL;
+                       }
                }
        }