diff options
Diffstat (limited to 'thread.c')
-rw-r--r-- | thread.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -444,6 +444,13 @@ void dispatch_conn_new(int sfd, enum conn_states init_state, int event_flags, int read_buffer_size, enum network_transport transport) { CQ_ITEM *item = cqi_new(); char buf[1]; + if (item == NULL) { + close(sfd); + /* given that malloc failed this may also fail, but let's try */ + fprintf(stderr, "Failed to allocate memory for connection object\n"); + return ; + } + int tid = (last_thread + 1) % settings.num_threads; LIBEVENT_THREAD *thread = threads + tid; |