加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-Fix-an-ancient-memleak-on-caps-parsing-add-tests.patch 1.15 KB
一键复制 编辑 原始数据 按行查看 历史
hugel 提交于 2024-07-24 10:20 . Backport some patches from upstream
From a385821780804b558ae18aec820d127e4144fafd Mon Sep 17 00:00:00 2001
From: Panu Matilainen <pmatilai@redhat.com>
Date: Thu, 11 Apr 2024 12:08:04 +0300
Subject: [PATCH] Fix an ancient memleak on %caps() parsing, add tests
Conflict:don't modify tests because the test case depends on the gcc.
Reference:https://github.com/rpm-software-management/rpm/commit/a385821780804b558ae18aec820d127e4144fafd
This leak has been there ever since rpm 4.7.0, so pretty close to 15
years. ASAN would've caught it, if it had it been tested. Oops.
Of course, in the fakechroot era we couldn't have tested installation
but we could've at least tested the parsing side.
Add tests for parsing, query and install functionality, and fix the
leak that is now very visible.
---
build/files.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/build/files.c b/build/files.c
index 14e4c55ef..b059458a1 100644
--- a/build/files.c
+++ b/build/files.c
@@ -228,6 +228,7 @@ static void copyFileEntry(FileEntry src, FileEntry dest)
static void FileEntryFree(FileEntry entry)
{
argvFree(entry->langs);
+ free(entry->caps);
memset(entry, 0, sizeof(*entry));
}
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化