udp: do not call pthread_{mutex,cond}_destroy when not initialized.
authoranonymous <anonymous>
Mon, 6 Aug 2012 07:56:50 +0000 (09:56 +0200)
committerClément Bœsch <ubitux@gmail.com>
Mon, 6 Aug 2012 08:06:26 +0000 (10:06 +0200)
This seems to cause a crash on Windows.

The author of that patch was a random guy on IRC who wants to stay anonymous.

libavformat/udp.c

index bd7665e..f93c607 100644 (file)
@@ -786,10 +786,9 @@ static int udp_close(URLContext *h)
         ret = pthread_join(s->circular_buffer_thread, NULL);
         if (ret != 0)
             av_log(h, AV_LOG_ERROR, "pthread_join(): %s\n", strerror(ret));
+        pthread_mutex_destroy(&s->mutex);
+        pthread_cond_destroy(&s->cond);
     }
-
-    pthread_mutex_destroy(&s->mutex);
-    pthread_cond_destroy(&s->cond);
 #endif
     av_fifo_free(s->fifo);
     return 0;