avformat/udp: add memory alloc checks

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
This commit is contained in:
Limin Wang 2021-01-07 18:22:07 +08:00
parent f6eaa864f3
commit 5ef20244de
1 changed files with 4 additions and 0 deletions

View 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));