From 0591261fd51bc9716e3bdc6d4bc4428f19575f8c Mon Sep 17 00:00:00 2001 From: Nick Krichevsky Date: Tue, 11 Sep 2018 16:00:31 -0400 Subject: [PATCH] More frees --- client/http_socket.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/http_socket.c b/client/http_socket.c index ee1d044..241aefd 100644 --- a/client/http_socket.c +++ b/client/http_socket.c @@ -107,6 +107,7 @@ enum socket_result send_request(struct http_message req, struct response_info *r int socket_fd = socket(addr_info->ai_family, addr_info->ai_socktype, addr_info->ai_protocol); if (socket_fd < 0) { + freeaddrinfo(addr_info); return RESULT_READ_ERROR; } @@ -116,12 +117,14 @@ enum socket_result send_request(struct http_message req, struct response_info *r // Initialize the time before beginning our connection int start_time_result = gettimeofday(&pre_connect_time, NULL); if (start_time_result != 0) { + freeaddrinfo(addr_info); close(socket_fd); return RESULT_PROCESSING_ERROR; } //Connect to the socket. int connection_status = connect(socket_fd, addr_info->ai_addr, addr_info->ai_addrlen); if (connection_status != 0) { + freeaddrinfo(addr_info); close(socket_fd); return RESULT_READ_ERROR; } @@ -129,6 +132,7 @@ enum socket_result send_request(struct http_message req, struct response_info *r //Get the end time of the connection int end_time_result = gettimeofday(&post_connect_time, NULL); if (end_time_result != 0) { + freeaddrinfo(addr_info); close(socket_fd); return RESULT_PROCESSING_ERROR; }