From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 5FFA849E11 for ; Fri, 12 Apr 2024 12:36:20 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3049468D26A; Fri, 12 Apr 2024 15:36:18 +0300 (EEST) Received: from m16.mail.163.com (m16.mail.163.com [220.197.31.5]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 31EB668CABE for ; Fri, 12 Apr 2024 15:36:10 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=r25u5 u9eAcAjIt/EPQZGBxj8PW0imALAVVjJK4EHIik=; b=YwEIRPJYSYptQ2s0sTsK7 ++cnpJfUDFalo8DWCLtOkwyDdkTj3NmpC22W+XSU2fmFUBujt7ZVeo3SZfHbaRBm PhTG8Tr4tSAQNrDhMdp6veF/VTvAZfB1P2YJAVTczJNyL0fb3m401kHUBlo92+ou 1YX5F68FFvPzYSLSVZiBRQ= Received: from localhost.localdomain (unknown [111.198.54.11]) by gzga-smtp-mta-g1-5 (Coremail) with SMTP id _____wD3X0uwKhlmEDG1Aw--.24607S2; Fri, 12 Apr 2024 20:36:02 +0800 (CST) From: LuMingYin To: ffmpeg-devel@ffmpeg.org Date: Fri, 12 Apr 2024 20:35:58 +0800 Message-Id: <20240412123558.1262807-1-lumingyindetect@163.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CM-TRANSID: _____wD3X0uwKhlmEDG1Aw--.24607S2 X-Coremail-Antispam: 1Uf129KBjvdXoW7Grykuw1kCFy7Zry8Zr1DKFg_yoWDtrX_Gr yrJr1xJr4Yqa4jqrW2krWFqFZ7KayFyFs5Wa4qqr1Yvw1fJan3XFn7WrZxZFWSqw4fKr9I kr95Zr1fXr1a9jkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7xR_5l1JUUUUU== X-Originating-IP: [111.198.54.11] X-CM-SenderInfo: poxpx0hj1l0vphwhu3i6rwjhhfrp/xtbBLxq+92XAkk+bhgACsb Subject: [FFmpeg-devel] [PATCH] fftools/ffmpeg_demux: fix memory leak on error path X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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: lumingyindetect@163.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: In the file ffmpeg_demux.c located at /FFmpeg/fftools/, a pointer variable named ic is defined at line 1531. At line 1589, the program allocates a dynamic memory area for it using the function avformat_alloc_context. When the if statement at line 1668 evaluates to true, the function returns at line 1673. Throughout this process, the dynamic memory area pointed to by the ic pointer is not deallocated, resulting in a memory leak. Signed-off-by: LuMingYin --- fftools/ffmpeg_demux.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c index cba63dab5f..2cfcc3c69d 100644 --- a/fftools/ffmpeg_demux.c +++ b/fftools/ffmpeg_demux.c @@ -1670,6 +1670,7 @@ int ifile_open(const OptionsContext *o, const char *filename, Scheduler *sch) "Error opening input: %s\n", av_err2str(err)); if (err == AVERROR_PROTOCOL_NOT_FOUND) av_log(d, AV_LOG_ERROR, "Did you mean file:%s?\n", filename); + avformat_free_context(ic); return err; } f->ctx = ic; -- 2.25.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".