]> git.sesse.net Git - ffmpeg/commitdiff
avformat/udp: add memory alloc checks
authorLimin Wang <lance.lmwang@gmail.com>
Thu, 7 Jan 2021 10:22:07 +0000 (18:22 +0800)
committerLimin Wang <lance.lmwang@gmail.com>
Sat, 16 Jan 2021 00:51:31 +0000 (08:51 +0800)
Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
libavformat/udp.c

index c4e403bbfc5bb5abf281808921a09ccd93514b07..9b9d3de197cf2bf8f3490668a5d5836d99a2f231 100644 (file)
@@ -903,6 +903,10 @@ static int udp_open(URLContext *h, const char *uri, int flags)
     if ((!is_output && s->circular_buffer_size) || (is_output && s->bitrate && s->circular_buffer_size)) {
         /* start the task going */
         s->fifo = av_fifo_alloc(s->circular_buffer_size);
+        if (!s->fifo) {
+            ret = AVERROR(ENOMEM);
+            goto fail;
+        }
         ret = pthread_mutex_init(&s->mutex, NULL);
         if (ret != 0) {
             av_log(h, AV_LOG_ERROR, "pthread_mutex_init failed : %s\n", strerror(ret));