From patchwork Mon Apr 15 13:24:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Fu, Linjie" X-Patchwork-Id: 12744 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 5B93C4477B0 for ; Mon, 15 Apr 2019 08:24:18 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 41CDD68A667; Mon, 15 Apr 2019 08:24:18 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 51E726898C4 for ; Mon, 15 Apr 2019 08:24:12 +0300 (EEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Apr 2019 22:24:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,352,1549958400"; d="scan'208";a="131412704" Received: from media_lj_kbl.sh.intel.com ([10.239.13.101]) by orsmga007.jf.intel.com with ESMTP; 14 Apr 2019 22:24:09 -0700 From: Linjie Fu To: ffmpeg-devel@ffmpeg.org Date: Mon, 15 Apr 2019 21:24:06 +0800 Message-Id: <20190415132406.20464-1-linjie.fu@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [FFmpeg-devel] [PATCH] lavf/qsvvpp: avoid the double-free when working in sys memory mode 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: Linjie Fu MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Currently, picref will be freed by calling av_frame_free(&picref) in submit_frame() in qsvvpp.c when working in system memory mode,and normally it is freed in filter_frame() in vf_vpp_qsv.c when working in other modes. Double free happens when working in system memory mode, remove to fix the memory issue. Signed-off-by: Linjie Fu --- Can be reproduced by applying the system memory patch and qsvdec+vpp: ffmpeg -init_hw_device qsv=hw -filter_hw_device hw -c:v h264_qsv -i input.mp4 \ -vf "vpp_qsv=w=960:h=540,format=rgb32" -f null - libavfilter/qsvvpp.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c index 06efdf5089..5cd1d5d345 100644 --- a/libavfilter/qsvvpp.c +++ b/libavfilter/qsvvpp.c @@ -316,7 +316,6 @@ static QSVFrame *submit_frame(QSVVPPContext *s, AVFilterLink *inlink, AVFrame *p } av_frame_copy_props(qsv_frame->frame, picref); - av_frame_free(&picref); } else qsv_frame->frame = av_frame_clone(picref);