nvme: Fix potential memory leak
(cherry picked from commit 348b0e730ac6c6c2195a3142e378269a4989b174)
This commit is contained in:
parent
b387edf99e
commit
b957ebf2de
38
0004-nvme-Fix-potential-memory-leak.patch
Normal file
38
0004-nvme-Fix-potential-memory-leak.patch
Normal file
@ -0,0 +1,38 @@
|
||||
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
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
|
||||
Name: libblockdev
|
||||
Version: 3.0.4
|
||||
Release: 6
|
||||
Release: 7
|
||||
Summary: libblockdev is a C library supporting GObject introspection for manipulation of block devices
|
||||
License: LGPLv2+
|
||||
URL: https://github.com/storaged-project/libblockdev
|
||||
@ -12,6 +12,7 @@ Source0: https://github.com/storaged-project/libblockdev/releases/download/%{ver
|
||||
Patch1: 0001-Add-BDPluginSpec-constructor-and-use-it-in-plugin_sp.patch
|
||||
Patch2: 0002-Fix-leaking-error.patch
|
||||
Patch3: 0003-lvm-dbus-Fix-leaking-error-in-bd_lvm_init.patch
|
||||
Patch4: 0004-nvme-Fix-potential-memory-leak.patch
|
||||
|
||||
BuildRequires: make glib2-devel libyaml-devel libbytesize-devel parted-devel libuuid-devel ndctl-devel device-mapper-devel
|
||||
BuildRequires: device-mapper-devel systemd-devel nss-devel volume_key-devel >= 0.3.9-7 libblkid-devel libmount-devel
|
||||
@ -161,6 +162,12 @@ find %{buildroot} -type f -name "*.la" | xargs %{__rm}
|
||||
|
||||
|
||||
%changelog
|
||||
* Fri Jul 12 2024 cenhuilin <cenhuilin@kylinos.cn> - 3.0.4-7
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC:nvme: Fix potential memory leak
|
||||
|
||||
* Tue Jun 25 2024 liuh <liuhuan01@kylinos.cn> - 3.0.4-6
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user