[FFmpeg-devel] [PATCH 1/5] avformat/udp: add memory alloc checks

lance.lmwang at gmail.com lance.lmwang at gmail.com
Wed Jan 6 17:35:27 EET 2021


From: Limin Wang <lance.lmwang at gmail.com>

Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
---
 libavformat/udp.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavformat/udp.c b/libavformat/udp.c
index 13c346a..d33e4d6 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -892,6 +892,10 @@ static int udp_open(URLContext *h, const char *uri, int flags)
 
         /* start the task going */
         s->fifo = av_fifo_alloc(s->circular_buffer_size);
+        if (!s->fifo) {
+            av_log(h, AV_LOG_ERROR, "av_fifo_alloc failed\n");
+            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));
-- 
1.8.3.1



More information about the ffmpeg-devel mailing list