avdevice/iec61883: Check pthread init for failures
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 7 Jun 2015 16:57:55 +0000 (18:57 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 7 Jun 2015 16:57:55 +0000 (18:57 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavdevice/iec61883.c

index b29aad1..01e5289 100644 (file)
@@ -392,9 +392,12 @@ static int iec61883_read_header(AVFormatContext *context)
 
 #if THREADS
     dv->thread_loop = 1;
-    pthread_mutex_init(&dv->mutex, NULL);
-    pthread_cond_init(&dv->cond, NULL);
-    pthread_create(&dv->receive_task_thread, NULL, iec61883_receive_task, dv);
+    if (pthread_mutex_init(&dv->mutex, NULL))
+        goto fail;
+    if (pthread_cond_init(&dv->cond, NULL))
+        goto fail;
+    if (pthread_create(&dv->receive_task_thread, NULL, iec61883_receive_task, dv))
+        goto fail;
 #endif
 
     return 0;