Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions fiche.c
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,8 @@ static void *handle_connection(void *args) {
}

// Create a buffer
uint8_t buffer[c->settings->buffer_len];
// uint8_t buffer[c->settings->buffer_len];
uint8_t* buffer = malloc(c->settings->buffer_len);
memset(buffer, 0, c->settings->buffer_len);

const int r = recv(c->socket, buffer, sizeof(buffer), MSG_WAITALL);
Expand All @@ -574,6 +575,7 @@ static void *handle_connection(void *args) {

// Cleanup
free(c);
free(buffer);
pthread_exit(NULL);

return 0;
Expand Down Expand Up @@ -614,9 +616,10 @@ static void *handle_connection(void *args) {
print_separator();

// Cleanup
close(c->socket);
free(c);
free(slug);
close(c->socket);
free(buffer);
pthread_exit(NULL);
return NULL;
}
Expand All @@ -634,6 +637,7 @@ static void *handle_connection(void *args) {

// Cleanup
free(c);
free(buffer);
pthread_exit(NULL);
return NULL;
}
Expand All @@ -649,6 +653,7 @@ static void *handle_connection(void *args) {
// Cleanup
free(c);
free(slug);
free(buffer);
pthread_exit(NULL);
return NULL;
}
Expand Down Expand Up @@ -678,6 +683,7 @@ static void *handle_connection(void *args) {
// Perform cleanup of values used in this thread
free(slug);
free(c);
free(buffer);

pthread_exit(NULL);

Expand Down