Fix leaks
This commit is contained in:
parent
f7d469bb00
commit
10cff3572b
|
@ -66,4 +66,5 @@ void get_parts(const char *dest, char *path_buffer, char *host_buffer) {
|
|||
}
|
||||
strcpy(path_buffer, slash_cursor);
|
||||
strncpy(host_buffer, dest, slash_cursor - dest);
|
||||
host_buffer[slash_cursor - dest] = '\0';
|
||||
}
|
||||
|
|
|
@ -142,6 +142,9 @@ enum socket_read_result send_request(struct http_message req, struct response_in
|
|||
res_info->rtt = end_time - start_time;
|
||||
res_info->contents = res.contents;
|
||||
close(socket_fd);
|
||||
free(res.start_line);
|
||||
free_headers(res.headers);
|
||||
freeaddrinfo(addr_info);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -86,7 +86,6 @@ static struct line_read_result read_line(const char *buffer, int buffer_size, st
|
|||
result.line_type = RESULT_START_LINE;
|
||||
message->start_line = malloc((line_size + 1) * sizeof(char));
|
||||
strcpy(message->start_line, result.line);
|
||||
message->start_line = result.line;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
Loading…
Reference in a new issue