Fixed use after frees & deadlocks in the child pump
This commit is contained in:
parent
83e96cbded
commit
2b1b823db0
2 changed files with 7 additions and 8 deletions
|
@ -153,8 +153,6 @@ static pthread_t child_pump;
|
|||
static bool child_pump_running;
|
||||
|
||||
static void *chld_pump_thread_main(void *nil) {
|
||||
child_pump_running = true;
|
||||
|
||||
do {
|
||||
handle_sigchld_pump();
|
||||
usleep(1000);
|
||||
|
@ -166,11 +164,8 @@ static void *chld_pump_thread_main(void *nil) {
|
|||
|
||||
void init_proc_compat(void) {
|
||||
#ifndef VANILLA_WIN32
|
||||
pthread_attr_t attr;
|
||||
int err = pthread_attr_init(&attr)
|
||||
|| pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED)
|
||||
|| pthread_create(&child_pump, &attr, chld_pump_thread_main, NULL)
|
||||
|| pthread_attr_destroy(&attr);
|
||||
child_pump_running = true;
|
||||
int err = pthread_create(&child_pump, NULL, chld_pump_thread_main, NULL);
|
||||
if (err) {
|
||||
perror(0);
|
||||
exit(1);
|
||||
|
@ -181,6 +176,7 @@ void init_proc_compat(void) {
|
|||
void free_proc_compat(void) {
|
||||
#ifndef VANILLA_WIN32
|
||||
child_pump_running = false;
|
||||
pthread_join(child_pump, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -411,7 +411,10 @@ static int criterion_run_all_tests_impl(struct criterion_test_set *set) {
|
|||
|
||||
cleanup:
|
||||
free_proc_compat();
|
||||
nn_close(sock);
|
||||
if (is_runner()) {
|
||||
close_socket (g_client_socket);
|
||||
close_socket (sock);
|
||||
}
|
||||
sfree(stats);
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue