From patchwork Mon May 14 12:18:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Zhili X-Patchwork-Id: 8951 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:155:0:0:0:0:0 with SMTP id c82-v6csp53655jad; Mon, 14 May 2018 05:19:05 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrw8ZhX0aLSJMJCdyMepwxNDy+Z9lezFcmgADGmaJESwaleGrtZYzq9ZO4LqZgQZ6BQiueI X-Received: by 2002:a1c:6b57:: with SMTP id g84-v6mr4725465wmc.127.1526300345040; Mon, 14 May 2018 05:19:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526300345; cv=none; d=google.com; s=arc-20160816; b=qQXV28WfP35IFIfZ8V4A10cgGwog1hKWjssQMtaj2Dl+EOLpf7njKNLWCz3i4p0Qh7 C3w5cszmp6nMEarxXqzP2ZU7nccACWkcd8gLvRur6OIXgp6qLSnupOvkHPmyzAUogF5P kBWTcMJPtL91hxGslFSQXYwXWEj9fhU1wFosjIIGmUN5X1u8z9iv7AX0cZjgbwT4oWGM mmxkGrTPNr63Dvgek4sdQ/VX7eSU1iLvQ+r5QZg6J8sBsFPlhFoLpdsXb/4bpF9GUNOy UNvSih/+5zV/psxGmobp/f9LWrwxiyD1ApNc6eHvFYrYdDxJ2oRkHLUWUv9UU/ZXQOCl Z8mA== 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:feedback-id:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=DyLKMWvJuIwWk5eT1E1rtLj8W0dJaANEHpG4AwQFqbE=; b=pLSRT8k+jPSEXbhGrrnmJvMJ7pakRsDUj0m6a95atQt3REovumei0SEk+9MD6qwFw7 6KMYt/0Xgg7wtJc1//Q6O6OnapllBH73KaaJ0QZON09xPDV66fAXBTrEWSQ8kcJKxn+i fB4NtPoCZw33SkFPjZp2aOfRdASbfPzAbff9LqPvvPydFH8ksd/U3ovjQ16lWprOO5uY ybhr9828vtZR7Aepb7WgM6TSCNFee8+rLzYU+7ElOwupBBB3g5vqbNGgeNC8t4KJqscj vMWOdWue2aRzZVbuL4DFyZLz2sO6T+AMrSlWiRhOpYpNWQooFc0UvGxj6e1LveuHbT2i bCoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b=rZqf+GG/; 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=foxmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id b2-v6si7888927wrc.306.2018.05.14.05.19.04; Mon, 14 May 2018 05:19:05 -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=@foxmail.com header.s=s201512 header.b=rZqf+GG/; 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=foxmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 112B76898D4; Mon, 14 May 2018 15:18:17 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtpbg13.qq.com (SMTPBG13.QQ.COM [183.60.61.234]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8F255689767 for ; Mon, 14 May 2018 15:18:09 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1526300300; bh=6AMzpVQ1Xx7g56lMjNRWo8KbflM6giaYu6hQ09x7QSM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=rZqf+GG/nqaV/pCORpuxR7+Yk+LzdigsJz0k0UCe3ZOJz9sYRBC7lrHcCdezOeqCt chJCE1pjaYfKnvUBRiMcc/N2uc4aP5KWbP11LD6AqDy02l15GYBRy8xu0w4xwXiAwk ILsT7YqGCu0QMAIQCgL+JoVzNR2agFhcPp4xT9kw= X-QQ-mid: esmtp23t1526300300t96xb8en9 Received: from localhost.localdomain (unknown [119.145.5.45]) by esmtp4.qq.com (ESMTP) with id ; Mon, 14 May 2018 20:18:18 +0800 (CST) X-QQ-SSF: 01000000000000F0F71000000000001 X-QQ-FEAT: oGLsAtV5lZJwbYwgPZ8pLU0x18vfwais7l0aEJoAO6t2xCAU9zfcO3NBUqn5w DjQMhbL6OcVL8wkjX+G5GRC3UrBTBMxKTOD28Quk1UCiRA0iZNHJ/TuCxwemD9xnMwI4gbY lbh9Z13jtjLQdjvp6Aa0akS9UqDv/pKrJdfnq6Sx+1UiZTznzP16DR8ktZ9m/K9I5C/c8tT exAF6LI7O3TBiPRkexYU7bC07u0SvUYaoA0eabI4dDpug3gvti/Z3AQ6Ko6eTh3+OgBHgH8 2C7xD5HHzpEKVncrTaYCZDmrA= X-QQ-GoodBg: 0 From: Zhao Zhili To: ffmpeg-devel@ffmpeg.org Date: Mon, 14 May 2018 20:18:01 +0800 Message-Id: <20180514121802.14519-4-quinkblack@foxmail.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20180514121802.14519-1-quinkblack@foxmail.com> References: <20180514121802.14519-1-quinkblack@foxmail.com> X-QQ-SENDSIZE: 520 Feedback-ID: esmtp:foxmail.com:bgforeign:bgforeign1 X-QQ-Bgrelay: 1 Subject: [FFmpeg-devel] [PATCH 4/5] examples/filtering_video: fix memory leak 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: Zhao Zhili MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Zhao Zhili --- doc/examples/filtering_video.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/doc/examples/filtering_video.c b/doc/examples/filtering_video.c index 2cc55e8..324d566 100644 --- a/doc/examples/filtering_video.c +++ b/doc/examples/filtering_video.c @@ -211,18 +211,21 @@ int main(int argc, char **argv) { int ret; AVPacket packet; - AVFrame *frame = av_frame_alloc(); - AVFrame *filt_frame = av_frame_alloc(); + AVFrame *frame; + AVFrame *filt_frame; - if (!frame || !filt_frame) { - perror("Could not allocate frame"); - exit(1); - } if (argc != 2) { fprintf(stderr, "Usage: %s file\n", argv[0]); exit(1); } + frame = av_frame_alloc(); + filt_frame = av_frame_alloc(); + if (!frame || !filt_frame) { + perror("Could not allocate frame"); + exit(1); + } + if ((ret = open_input_file(argv[1])) < 0) goto end; if ((ret = init_filters(filter_descr)) < 0)