From patchwork Fri Mar 10 01:23:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Zhao X-Patchwork-Id: 2866 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.50.79 with SMTP id y76csp583962vsy; Thu, 9 Mar 2017 17:24:04 -0800 (PST) X-Received: by 10.28.61.11 with SMTP id k11mr68620wma.119.1489109044736; Thu, 09 Mar 2017 17:24:04 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id i3si10820612wrb.104.2017.03.09.17.24.04; Thu, 09 Mar 2017 17:24:04 -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=@gmail.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id F00086891F3; Fri, 10 Mar 2017 03:23:47 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pg0-f50.google.com (mail-pg0-f50.google.com [74.125.83.50]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 98A516891E4 for ; Fri, 10 Mar 2017 03:23:41 +0200 (EET) Received: by mail-pg0-f50.google.com with SMTP id 77so32589876pgc.1 for ; Thu, 09 Mar 2017 17:23:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version; bh=kU1cdRqEuoZGKVXDK9a01368xCkvO4dMQsLU9cncPb0=; b=redQDhexeB2wETZSEm/eZ2YWaIdd/Llr+9udbX7kfvad7YAVzqLw/i3sEsxaeRZ8v2 BR/jtYeDWnV//QH8/fnIxcgcWDBGpFv9k4cW3tmuaxMEcBAZN3yxSyi++R6nQl78XNmO nNl3uVuWXnELvOldvf5VYpCJqZ4hIWgndLo31GMAcYmM4ieAPq+OlBsW8reIDriDVkDQ 18+z+v4Lm4XOrTFjfPzs/pgevQ3Ljbp7INa3MNRxyHjov8wmWIx7pSnX9M49ZEN2mqX1 a8pAgjVQMwKw0WUkaTR0TVQSyKHdyE4J4JRaneyttlvtXL5l9vj2nE/jqAtYPRsBpaZq SMOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version; bh=kU1cdRqEuoZGKVXDK9a01368xCkvO4dMQsLU9cncPb0=; b=FhHdyM1j4srr4DG+AK/5327F3r/puHWkTF4wonyQN12BVYwakhVxdYtZhyPcqpTp0A VwzDsXouHNx3vtXRPMzH9IpQzUvBUaAsyPIYr/dkkN23ThjfFEDgG7FlsuX4ZEefgHn6 st5zTqfinETocuq/pCnX8g6XtGp6M2P3govSw9/PpTyYDZ7yp794bFFFcV9FWZTvlUXo a3t2jmD9BOVHgltoO4Bn16qcvziB36L+zDdCA2B5HSy4gSOWo800A+7dbcVrLq/mb9UX Q14XuhtxGNw8qSGuV3/zN2kHrW7Roc+LXJl3WsyDpWCVnI+6KpzcEmHsh1ELiVSiEjKM XqxA== X-Gm-Message-State: AMke39nA7XjTW/fsPCoK1yN8Q8M8oD0qDl2g4FLY494ZzpokVcIY81e487IM4ItG8wGlNQ== X-Received: by 10.84.211.97 with SMTP id b88mr21563620pli.113.1489109034160; Thu, 09 Mar 2017 17:23:54 -0800 (PST) Received: from [10.239.204.195] (fmdmzpr03-ext.fm.intel.com. [192.55.54.38]) by smtp.gmail.com with ESMTPSA id r89sm14747485pfe.6.2017.03.09.17.23.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Mar 2017 17:23:52 -0800 (PST) To: Mark Thompson , FFmpeg development discussions and patches From: Jun Zhao Message-ID: Date: Fri, 10 Mar 2017 09:23:50 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH V3] vf_hwupload: Add missing return value check 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" V3: just remove noop ff_formats_unref() and add missing return value checks to suppress build warning. From 67633ff014ee472a6494d792c8c8e057acc197c4 Mon Sep 17 00:00:00 2001 From: Jun Zhao Date: Fri, 3 Mar 2017 09:25:53 +0800 Subject: [PATCH] vf_hwupload: Add missing return value check Add missing return value checks to suppress build warning and remove noop ff_formats_unref() calling. Note: most filters using ff_formats_ref() didn't have a suitable error handling, it's a potential memory leak issue. Signed-off-by: Jun Zhao --- libavfilter/vf_hwupload.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/libavfilter/vf_hwupload.c b/libavfilter/vf_hwupload.c index 08af2dd..f54ce9f 100644 --- a/libavfilter/vf_hwupload.c +++ b/libavfilter/vf_hwupload.c @@ -74,17 +74,15 @@ static int hwupload_query_formats(AVFilterContext *avctx) if (input_pix_fmts) { for (i = 0; input_pix_fmts[i] != AV_PIX_FMT_NONE; i++) { err = ff_add_format(&input_formats, input_pix_fmts[i]); - if (err < 0) { - ff_formats_unref(&input_formats); + if (err < 0) goto fail; - } } } - ff_formats_ref(input_formats, &avctx->inputs[0]->out_formats); - - ff_formats_ref(ff_make_format_list(output_pix_fmts), - &avctx->outputs[0]->in_formats); + if ((err = ff_formats_ref(input_formats, &avctx->inputs[0]->out_formats)) < 0 || + (err = ff_formats_ref(ff_make_format_list(output_pix_fmts), + &avctx->outputs[0]->in_formats)) < 0) + goto fail; av_hwframe_constraints_free(&constraints); return 0;