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:
parent
64891c9198
commit
87b0d6b13c
1 changed files with 1 additions and 0 deletions
|
@ -538,6 +538,7 @@ void *api_listen_thread (void *ptr)
|
||||||
api_list.conns[i] = malloc (sizeof (struct s_conns));
|
api_list.conns[i] = malloc (sizeof (struct s_conns));
|
||||||
if (!api_list.conns[i]) {
|
if (!api_list.conns[i]) {
|
||||||
libp2p_logger_error("api", "Fail to allocate memory to accept connection.\n");
|
libp2p_logger_error("api", "Fail to allocate memory to accept connection.\n");
|
||||||
|
pthread_mutex_unlock(&conns_lock);
|
||||||
close (s);
|
close (s);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue