1 Star 0 Fork 71

twwang/libvirt

forked from src-openEuler/libvirt 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
parthelper-Don-t-leak-canonical_path.patch 1.18 KB
一键复制 编辑 原始数据 按行查看 历史
From 87376268b3baf188e85095c5429d707d9a5e59a4 Mon Sep 17 00:00:00 2001
From: Michal Privoznik <mprivozn@redhat.com>
Date: Thu, 22 Oct 2020 12:55:40 +0200
Subject: [PATCH 069/108] parthelper: Don't leak @canonical_path
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The @canonical_path variable holds canonicalized path passed as
argv[1]. The canonicalized path is obtained either via
virFileResolveLink() or plain g_strdup(). Nevertheless, in both
cases it must be freed.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit db8e747af98df732aff67eca9fb67514310359bf)
---
src/storage/parthelper.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/storage/parthelper.c b/src/storage/parthelper.c
index 812e90d3cb..8278ddf31e 100644
--- a/src/storage/parthelper.c
+++ b/src/storage/parthelper.c
@@ -62,7 +62,7 @@ int main(int argc, char **argv)
PedPartition *part;
int cmd = DISK_LAYOUT;
const char *path;
- char *canonical_path;
+ g_autofree char *canonical_path = NULL;
const char *partsep;
bool devmap_partsep = false;
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/twwang/libvirt.git
git@gitee.com:twwang/libvirt.git
twwang
libvirt
libvirt
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385