Commit 40526af5 authored by Heiko Liermann's avatar Heiko Liermann
Browse files

bug fix memory leak

parent 56ceda7b
......@@ -88,8 +88,8 @@ void *thread_handler(void *args) {
// allocate memory init it with 0
uint8_t *write_buffer = (uint8_t *) calloc(1, 74 * sizeof(uint8_t));
uint8_t *read_buf = (uint8_t *) calloc(1, 74 * sizeof(uint8_t));
if (write_buffer == NULL || read_buf == NULL)
uint8_t *read_buffer = (uint8_t *) calloc(1, 74 * sizeof(uint8_t));
if (write_buffer == NULL || read_buffer == NULL)
perror("error on calloc");
FD_ZERO(&read_set);
......@@ -114,11 +114,12 @@ void *thread_handler(void *args) {
break;
}
if (FD_ISSET(client_fd, &read_set)) {
if (recv_wrapper(client_fd, read_buf, sizeof(read_buf), 0) == 0)
if (recv_wrapper(client_fd, read_buffer, sizeof(read_buffer), 0) == 0)
break;
}
}
close_wrapper(client_fd);
free(read_buffer);
free(write_buffer);
return NULL;
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment