From f9349c978609fdeec5c9e94e363d099f4001acff Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Mon, 16 Nov 2020 23:10:48 +0100 Subject: [PATCH] internal_parse_url: fix memory leak Signed-off-by: Nikos Mavrogiannopoulos --- http.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/http.c b/http.c index 39310289..ace81e0b 100644 --- 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; + } } } -- 2.50.1