From patchwork Wed Oct 19 12:00:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timo Rothenpieler X-Patchwork-Id: 1073 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.133 with SMTP id o127csp176346vsd; Wed, 19 Oct 2016 05:02:08 -0700 (PDT) X-Received: by 10.194.85.193 with SMTP id j1mr4082554wjz.23.1476878528863; Wed, 19 Oct 2016 05:02:08 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id i9si31673306wjk.185.2016.10.19.05.02.06; Wed, 19 Oct 2016 05:02:08 -0700 (PDT) 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=@rothenpieler.org; 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 8EFCF689B4C; Wed, 19 Oct 2016 15:01:01 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from btbn.de (btbn.de [5.9.118.179]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5E256689AF0 for ; Wed, 19 Oct 2016 15:00:55 +0300 (EEST) Received: from localhost.localdomain (ip4d173c0b.dynamic.kabel-deutschland.de [77.23.60.11]) by btbn.de (Postfix) with ESMTPSA id A02786FF60; Wed, 19 Oct 2016 14:00:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rothenpieler.org; s=mail; t=1476878453; bh=3YJl3yFN2KO0oUWCUJVyCJ30cdDszOP/Z9JsnlJFDpY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=vFOtDjS8hLXWEITXkYJ16XbCrfRqfcJyUqgKGo7tqrBWWKlT+h5pEo7J6ai0Fa/QT ItrmmU2LUNS5l/fqfJJ5ZSljlJuEAan2Zs6Pmc6qowNqRKD6CxYNICKoTjs9kelK6S 6rIc/TX0LMwh0Mf0o5lgDhD5C1jdVL1qCPQOoN9Y= From: Timo Rothenpieler To: ffmpeg-devel@ffmpeg.org Date: Wed, 19 Oct 2016 14:00:35 +0200 Message-Id: <20161019120036.618-7-timo@rothenpieler.org> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20161019120036.618-1-timo@rothenpieler.org> References: <20161019120036.618-1-timo@rothenpieler.org> Subject: [FFmpeg-devel] [PATCH 7/8] avfilter/vf_hwupload_cuda: check ff_formats_ref for errors 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: Timo Rothenpieler MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libavfilter/vf_hwupload_cuda.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libavfilter/vf_hwupload_cuda.c b/libavfilter/vf_hwupload_cuda.c index dba496f..14688df 100644 --- a/libavfilter/vf_hwupload_cuda.c +++ b/libavfilter/vf_hwupload_cuda.c @@ -54,6 +54,8 @@ static av_cold void cudaupload_uninit(AVFilterContext *ctx) static int cudaupload_query_formats(AVFilterContext *ctx) { + int ret; + static const enum AVPixelFormat input_pix_fmts[] = { AV_PIX_FMT_NV12, AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_NONE, @@ -64,8 +66,13 @@ static int cudaupload_query_formats(AVFilterContext *ctx) AVFilterFormats *in_fmts = ff_make_format_list(input_pix_fmts); AVFilterFormats *out_fmts = ff_make_format_list(output_pix_fmts); - ff_formats_ref(in_fmts, &ctx->inputs[0]->out_formats); - ff_formats_ref(out_fmts, &ctx->outputs[0]->in_formats); + ret = ff_formats_ref(in_fmts, &ctx->inputs[0]->out_formats); + if (ret < 0) + return ret; + + ret = ff_formats_ref(out_fmts, &ctx->outputs[0]->in_formats); + if (ret < 0) + return ret; return 0; }