summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorLimin Wang <lance.lmwang@gmail.com>2021-01-07 18:22:07 +0800
committerLimin Wang <lance.lmwang@gmail.com>2021-01-16 08:51:31 +0800
commit5ef20244de8bf5f3d208041c43d9f082e1fb879e (patch)
tree5ba8c7819c4ff16ea6d0698237e39ac39e6a4cc1 /libavformat
parentf6eaa864f363dd9f632bb456b78c134e44904d3b (diff)
avformat/udp: add memory alloc checks
Reviewed-by: Marton Balint <cus@passwd.hu> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/udp.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavformat/udp.c b/libavformat/udp.c
index c4e403bbfc..9b9d3de197 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -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));