telize

High performance JSON IP and GeoIP REST API (IP Geolocation)
Log | Files | Refs | README | LICENSE

commit 66063c6c6e5bbbafcf493c5bc7c825f0a6e1b03d
parent 0b6c6d1ad37c7c17e6c0095dc74486759cdc8336
Author: Frederic Cambus <fred@statdns.com>
Date:   Thu, 11 Oct 2018 22:56:14 +0200

Do not leak memory when an invalid IP addresses is detected

Diffstat:
Msrc/location.c | 2++
1 file changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/location.c b/src/location.c @@ -98,6 +98,7 @@ location(struct http_request *req) !inet_pton(AF_INET6, ip, &(ipv6.sin6_addr))) { answer = "{\"code\": 401, \"message\": \"Input string is not a valid IP address\"}"; http_response(req, 400, answer, strlen(answer)); + goto cleanup; } if (http_argument_get_string(req, "callback", &callback)) { @@ -197,6 +198,7 @@ location(struct http_request *req) http_response_header(req, "content-type", "application/json; charset=utf-8"); http_response(req, 200, answer, strlen(answer)); +cleanup: kore_buf_free(&json); kore_free(addr);