Commit ee02148b authored by Rafaël Carré's avatar Rafaël Carré

android: fix detached threads leak

parent 17b44188
......@@ -308,17 +308,25 @@ int vlc_cond_timedwait (vlc_cond_t *condvar, vlc_mutex_t *p_mutex,
}
/* pthread */
static void clean_detached_thread(void *data)
{
struct vlc_thread *thread = data;
/* release thread handle */
vlc_mutex_destroy(&thread->lock);
free(thread);
}
static void *detached_thread(void *data)
{
vlc_thread_t th = data;
thread = th;
vlc_cleanup_push(clean_detached_thread, data);
th->entry(th->data);
vlc_cleanup_run();
/* release thread handle */
vlc_mutex_destroy(&th->lock);
free(th);
return NULL;
}
......@@ -454,7 +462,6 @@ void vlc_testcancel (void)
return;
vlc_sem_post(&thread->finished);
#warning FIXME: memory leak for detached threads
pthread_exit(NULL);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment