From patchwork Mon Nov 27 02:22:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pan Bian X-Patchwork-Id: 6407 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.94 with SMTP id m30csp2095462jah; Mon, 27 Nov 2017 10:09:31 -0800 (PST) X-Google-Smtp-Source: AGs4zMa+GdRnTRzIQD6RxtcfM3Kdh1nRG0mdSTmGR+h6Zzq7GswMml7Ran3Vldq1cUXKSVQ8wBoz X-Received: by 10.223.157.137 with SMTP id p9mr34573127wre.92.1511806171485; Mon, 27 Nov 2017 10:09:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511806171; cv=none; d=google.com; s=arc-20160816; b=Z9JJy0uWW38FnJfgNZffsuU0YTPH+6DP5WrHKFC3L1ICHDzUvKLWt0x/1NScIX7rmk YGh/KCgWikoZKnuHKWTHij6GAI7fwKGSQ9RJs8VsyEfQ+nwrIKDUijFdBPHXZmms+0CU h6HDXpKwbb4eX5S7jW+Fv83y6dmlRnFtErNdK2VrqiBHzl/Xwww17upo9ho+Wq1CV211 zspVaVqYWu7R92jbC1Qn9KhHZirf/hAyA23qRl9cV5anOlymCNaO8QTpqc/U6439QuB/ zuIivjaDQKjnSllS35T6BzSM69my/O+aKeFSPPjSGERoLds9iy/7kGazlkCeQxUiS10c gF0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=jaJVaS4rkbMXTbtnRPSwoXtuuRhTtgdwzpDlfUf64HI=; b=JZjQ4tOZrZBNIWNAgJm/tOECN1DKAuTQSQDaYjW9VvliCW00QRfn2qyefENuEqZOeD lz7Ucj/VJ4AW8hyS+M2Q2SlQLFuRb4bV+342VFVXf2A2njI501SMLFfLfVtoA9djtU65 UnnJvWWjpOIj1WkOutsQ4SL+ww/H3Q8YW2GBGVik/ZtducgD+jUz5LLZsByy+UV5IRx9 LZuImNEVqBWN+wHsiW4zYrKXmdbXvdMzS3UBXN3WnOPEm6THh2P7C1+0/IyvqYe/a07H 0IRw+xuu8cEkMZ3i5Dphp1lKDKd5XDqjgLeqhpKUw+Hlgjy1hH05mJ0QeVlS8Fmq5kTq +zGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@163.com header.s=s110527 header.b=o5QvPC1n; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id y109si23004828wrc.333.2017.11.27.10.09.30; Mon, 27 Nov 2017 10:09:31 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@163.com header.s=s110527 header.b=o5QvPC1n; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 136B968A30B; Mon, 27 Nov 2017 20:09:27 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from m12-15.163.com (m12-15.163.com [220.181.12.15]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 71F0968997A for ; Mon, 27 Nov 2017 04:22:51 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=TJE1NxvbShOl82f0RA 057iYWCwhWqBbe4XX62p5E8Gk=; b=o5QvPC1nmEmZqTn4E5FAwa3kC5q3MSxMut taqPxGaqmrvQSD590dhXZtIfgoGlHfNURAB74R2VU0qD/3lCCZ5mc8yxUhUGUgiG MCZrgHvykcSUJoskWG55a+hH3zyUfnXRpp6QS7GfuEEc3n1ndmbupdNM5SL1pMI/ lWNZOI+Xk= Received: from localhost.localdomain (unknown [106.120.213.112]) by smtp11 (Coremail) with SMTP id D8CowAB3NFX4dhtad8y7BQ--.50404S3; Mon, 27 Nov 2017 10:22:51 +0800 (CST) From: Pan Bian To: ffmpeg-devel@ffmpeg.org Date: Mon, 27 Nov 2017 10:22:47 +0800 Message-Id: <1511749367-24432-1-git-send-email-bianpan2016@163.com> X-Mailer: git-send-email 1.9.1 X-CM-TRANSID: D8CowAB3NFX4dhtad8y7BQ--.50404S3 X-Coremail-Antispam: 1Uf129KBjvJXoW7Wr15GF4xWF18tF15Zr13Jwb_yoW8Jr47pF sIkrW2kF1rJF9xuryqywn5Zw15CFZ5JF13WFn5G3yUCrsxCrn7Zw4ak340kw4DCFZ0kry2 vrs09w17JrWDCFJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jO73kUUUUU= X-Originating-IP: [106.120.213.112] X-CM-SenderInfo: held01tdqsiiqw6rljoofrz/xtbBURudclaDwFWFFwAAs3 X-Mailman-Approved-At: Mon, 27 Nov 2017 20:09:25 +0200 Subject: [FFmpeg-devel] avfilter/avf_ahistogram: return correct error code 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: Pan Bian MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" In function query_formats(), it incorrectly returns 0 when the function ff_all_channel_counts() returns a NULL pointer (the check of variable ret before the NULL check guarantees that the return value is not negative). Signed-off-by: Pan Bian --- libavfilter/avf_ahistogram.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libavfilter/avf_ahistogram.c b/libavfilter/avf_ahistogram.c index 5874151..1b779da 100644 --- a/libavfilter/avf_ahistogram.c +++ b/libavfilter/avf_ahistogram.c @@ -97,9 +97,11 @@ static int query_formats(AVFilterContext *ctx) int ret = AVERROR(EINVAL); formats = ff_make_format_list(sample_fmts); - if ((ret = ff_formats_ref (formats, &inlink->out_formats )) < 0 || - (layouts = ff_all_channel_counts()) == NULL || - (ret = ff_channel_layouts_ref (layouts, &inlink->out_channel_layouts)) < 0) + if ((ret = ff_formats_ref(formats, &inlink->out_formats)) < 0) + return ret; + if (!(layouts = ff_all_channel_counts())) + return AVERROR(ENOMEM); + if ((ret = ff_channel_layouts_ref(layouts, &inlink->out_channel_layouts)) < 0) return ret; formats = ff_all_samplerates();