avformat/udp: Protect write to circular_buffer_error by mutex
authorMichael Niedermayer <michael@niedermayer.cc>
Thu, 2 Jun 2016 11:30:12 +0000 (13:30 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 2 Jun 2016 11:41:04 +0000 (13:41 +0200)
This isnt really needed on most platforms but
fixes CID1362183

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/udp.c

index 9499a72..0f35689 100644 (file)
@@ -605,7 +605,9 @@ static void *circular_buffer_task_tx( void *_URLContext)
             } else {
                 ret = ff_neterrno();
                 if (ret != AVERROR(EAGAIN) && ret != AVERROR(EINTR)) {
+                    pthread_mutex_lock(&s->mutex);
                     s->circular_buffer_error = ret;
+                    pthread_mutex_unlock(&s->mutex);
                     return NULL;
                 }
             }