More frees
This commit is contained in:
parent
4895b252e9
commit
0591261fd5
|
@ -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);
|
int socket_fd = socket(addr_info->ai_family, addr_info->ai_socktype, addr_info->ai_protocol);
|
||||||
if (socket_fd < 0) {
|
if (socket_fd < 0) {
|
||||||
|
freeaddrinfo(addr_info);
|
||||||
return RESULT_READ_ERROR;
|
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
|
// Initialize the time before beginning our connection
|
||||||
int start_time_result = gettimeofday(&pre_connect_time, NULL);
|
int start_time_result = gettimeofday(&pre_connect_time, NULL);
|
||||||
if (start_time_result != 0) {
|
if (start_time_result != 0) {
|
||||||
|
freeaddrinfo(addr_info);
|
||||||
close(socket_fd);
|
close(socket_fd);
|
||||||
return RESULT_PROCESSING_ERROR;
|
return RESULT_PROCESSING_ERROR;
|
||||||
}
|
}
|
||||||
//Connect to the socket.
|
//Connect to the socket.
|
||||||
int connection_status = connect(socket_fd, addr_info->ai_addr, addr_info->ai_addrlen);
|
int connection_status = connect(socket_fd, addr_info->ai_addr, addr_info->ai_addrlen);
|
||||||
if (connection_status != 0) {
|
if (connection_status != 0) {
|
||||||
|
freeaddrinfo(addr_info);
|
||||||
close(socket_fd);
|
close(socket_fd);
|
||||||
return RESULT_READ_ERROR;
|
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
|
//Get the end time of the connection
|
||||||
int end_time_result = gettimeofday(&post_connect_time, NULL);
|
int end_time_result = gettimeofday(&post_connect_time, NULL);
|
||||||
if (end_time_result != 0) {
|
if (end_time_result != 0) {
|
||||||
|
freeaddrinfo(addr_info);
|
||||||
close(socket_fd);
|
close(socket_fd);
|
||||||
return RESULT_PROCESSING_ERROR;
|
return RESULT_PROCESSING_ERROR;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue