We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents b981095 + d079a50 commit 402d342Copy full SHA for 402d342
main.c
@@ -89,10 +89,9 @@ struct state {
89
} _state;
90
91
static void state_add_socket_fd(struct state *state, int socket_fd) {
92
- dispatch_semaphore_wait(state->sem, DISPATCH_TIME_FOREVER);
93
- struct conn *conn = malloc(sizeof(struct conn));
94
- memset(conn, 0, sizeof(*conn));
+ struct conn *conn = calloc(1, sizeof(*conn));
95
conn->socket_fd = socket_fd;
+ dispatch_semaphore_wait(state->sem, DISPATCH_TIME_FOREVER);
96
if (state->conns == NULL) {
97
state->conns = conn;
98
} else {
0 commit comments