[FFmpeg-cvslog] pthreads: fix segfault due to the thread beimg killed before it has been allocated

Michael Niedermayer git at videolan.org
Sat Nov 26 18:43:06 CET 2011


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat Nov 26 17:55:01 2011 +0100| [61c2cec9579b5a24e95102b137eab3ecc6902d15] | committer: Michael Niedermayer

pthreads: fix segfault due to the thread beimg killed before it has been allocated

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=61c2cec9579b5a24e95102b137eab3ecc6902d15
---

 libavcodec/pthread.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index eb30472..e3815ba 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);



More information about the ffmpeg-cvslog mailing list