module-rt: first join and then free memory

First join the thread and then free the memory or else we might free the
memory while the thread is starting up and we crash.
This commit is contained in:
Wim Taymans 2024-09-26 16:21:32 +02:00
parent fe3dc58c89
commit 18e1da54bd

View file

@ -747,6 +747,9 @@ static int impl_join(void *object, struct spa_thread *thread, void **retval)
struct impl *impl = object; struct impl *impl = object;
pthread_t pt = (pthread_t)thread; pthread_t pt = (pthread_t)thread;
struct thread *thr; struct thread *thr;
int res;
res = pthread_join(pt, retval);
pthread_mutex_lock(&impl->lock); pthread_mutex_lock(&impl->lock);
if ((thr = find_thread_by_pt(impl, pt)) != NULL) { if ((thr = find_thread_by_pt(impl, pt)) != NULL) {
@ -755,7 +758,7 @@ static int impl_join(void *object, struct spa_thread *thread, void **retval)
} }
pthread_mutex_unlock(&impl->lock); pthread_mutex_unlock(&impl->lock);
return pthread_join(pt, retval); return res;
} }