7 Star 0 Fork 19

src-openEuler/libblockdev

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0004-nvme-Fix-potential-memory-leak.patch 1.45 KB
一键复制 编辑 原始数据 按行查看 历史
cenhuilin 提交于 2024-07-12 15:19 +08:00 . nvme: Fix potential memory leak
From 5a148f4b94fb047c6bbf4cdbc54504207560e94c Mon Sep 17 00:00:00 2001
From: Tomas Bzatek <tbzatek@redhat.com>
Date: Fri, 12 Jul 2024 15:13:33 +0800
Subject: [PATCH] nvme: Fix potential memory leak
This should not happen in practice when the NVMe spec
is thoroughly followed.
---
src/plugins/nvme/nvme-info.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/plugins/nvme/nvme-info.c b/src/plugins/nvme/nvme-info.c
index eaf7747..947b1f0 100644
--- a/src/plugins/nvme/nvme-info.c
+++ b/src/plugins/nvme/nvme-info.c
@@ -672,16 +672,19 @@ BDNVMENamespaceInfo *bd_nvme_get_namespace_info (const gchar *device, GError **e
switch (d->nidt) {
case NVME_NIDT_EUI64:
+ g_free (info->eui64);
info->eui64 = g_malloc0 (d->nidl * 2 + 1);
for (i = 0; i < d->nidl; i++)
snprintf (info->eui64 + i * 2, 3, "%02x", d->nid[i]);
break;
case NVME_NIDT_NGUID:
+ g_free (info->nguid);
info->nguid = g_malloc0 (d->nidl * 2 + 1);
for (i = 0; i < d->nidl; i++)
snprintf (info->nguid + i * 2, 3, "%02x", d->nid[i]);
break;
case NVME_NIDT_UUID:
+ g_free (info->uuid);
info->uuid = _uuid_to_str (d->nid);
break;
case NVME_NIDT_CSI:
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/libblockdev.git
git@gitee.com:src-openeuler/libblockdev.git
src-openeuler
libblockdev
libblockdev
master

搜索帮助