From 61c2cec9579b5a24e95102b137eab3ecc6902d15 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 26 Nov 2011 17:55:01 +0100 Subject: [PATCH] pthreads: fix segfault due to the thread beimg killed before it has been allocated Signed-off-by: Michael Niedermayer --- libavcodec/pthread.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c index eb304720e4..e3815ba6d3 100644 --- a/libavcodec/pthread.c +++ b/libavcodec/pthread.c @@ -658,7 +658,8 @@ static void frame_thread_free(AVCodecContext *avctx, int thread_count) pthread_cond_signal(&p->input_cond); pthread_mutex_unlock(&p->mutex); - pthread_join(p->thread, NULL); + if(p->thread) + pthread_join(p->thread, NULL); if (codec->close) codec->close(p->avctx);