From patchwork Fri Jan 8 06:32:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 24842 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id AB64344A2DA for ; Fri, 8 Jan 2021 08:32:38 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9459B689AB4; Fri, 8 Jan 2021 08:32:38 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CC64E689DA7 for ; Fri, 8 Jan 2021 08:32:31 +0200 (EET) Received: by mail-pg1-f172.google.com with SMTP id i7so7033388pgc.8 for ; Thu, 07 Jan 2021 22:32:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=dKuh3RStvFIrC6OFj9R9iBd0HrRS252V4FHc0nlFqpA=; b=TSX5MGKr0lXU+0fVgDSh2waFuCn+DChP0W/80sS2heLb/bR5urDcbkSiPaF/O5g8An RmMej91nIzGTlQigsrxK07ePFdCClu6n9O7k4n9fWZaMiHbznF0Yg/FMMS7JoHaaVPjn r4omp7TQnzVxZZBVyNSBez2ftd53XXP+llPuxkSMQrcidk7mRKfDEQdKb0f3HqU78l7Q stlkzjMXOibXW1F4gaHx2AiGHSxoS6Nq8kTOmV2VEyCRkTKm/LZfZwV5GqJ0a3TvUAwh mXEjUQr4NbV+RQoB3VDcIS9/jxZQZ6A2nw/oT2nb2wMiKWQ9Ps+bSZQ0YHGhdDqn7XKg uxXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=dKuh3RStvFIrC6OFj9R9iBd0HrRS252V4FHc0nlFqpA=; b=bMLmk/WXFcpWMJACmBL0PrWhqAQc3OyVAA+XQm0rvyDweQCUwxgL3/cCaDGKQBsShn V7L9K0GZJonsirs9tGNbxggJnBFZpXM1bBysBB425C2OCA+z8QvKLDJdHCyQd2kuEsZ9 lyucsAT9mG3RxoOyQDO3ojMA2HJzly6kiRsUqHgMcqAd9xtkumVcF1aCTfmV0VTekHcp s2uCE5QHLCR4Xc4C2b5mqHz38s7wjl0vDmIxq7x9fbpBc5arb4sUvD+qtJzLEIvviLa4 OMz8GeQCZPYFnz0H34bLzQ0VOffGdgMs/ef4B4JdJ3ia0jYFuqU4PZnUNEcKipD7zd6Z DZMw== X-Gm-Message-State: AOAM530lQpZavRYBdXhV1D9rW7psTLumbCUCj0h/Ku1js8EAN0sh5zTq XxI5H0vf+pPPtdBdCn/qqWMteCVBmlg= X-Google-Smtp-Source: ABdhPJzpSg4gh+4Qq9DKTL8v7AoSlPo5seeXpB+8m/qQqHSdmhoiVc/umnBfLCPogrPa+emXthVMtg== X-Received: by 2002:a05:6a00:882:b029:19c:5287:4a1e with SMTP id q2-20020a056a000882b029019c52874a1emr5535760pfj.44.1610087549735; Thu, 07 Jan 2021 22:32:29 -0800 (PST) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id f9sm7573612pfa.41.2021.01.07.22.32.28 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jan 2021 22:32:29 -0800 (PST) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Fri, 8 Jan 2021 14:32:21 +0800 Message-Id: <1610087542-12587-2-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1610087542-12587-1-git-send-email-lance.lmwang@gmail.com> References: <1610016199-29309-1-git-send-email-lance.lmwang@gmail.com> <1610087542-12587-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH v3 2/3] avformat/udp: add memory alloc checks X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Limin Wang Signed-off-by: Limin Wang --- libavformat/udp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavformat/udp.c b/libavformat/udp.c index 28987e0..333a612 100644 --- a/libavformat/udp.c +++ b/libavformat/udp.c @@ -892,6 +892,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));