Fix the mutex lock when the memory allocation fails in api_listen_thread.

Thanks to John Jones for pointing out the problem.
This commit is contained in:
Jose Marcial Vieira Bisneto 2017-09-20 08:29:51 -03:00
parent 64891c9198
commit 87b0d6b13c
No known key found for this signature in database
GPG key ID: 103E935E7E6E831E

View file

@ -538,6 +538,7 @@ void *api_listen_thread (void *ptr)
api_list.conns[i] = malloc (sizeof (struct s_conns));
if (!api_list.conns[i]) {
libp2p_logger_error("api", "Fail to allocate memory to accept connection.\n");
pthread_mutex_unlock(&conns_lock);
close (s);
continue;
}