diff --git a/0004-nvme-Fix-potential-memory-leak.patch b/0004-nvme-Fix-potential-memory-leak.patch new file mode 100644 index 0000000000000000000000000000000000000000..535342af35d673a9dd8f045d93c880a494dbea7b --- /dev/null +++ b/0004-nvme-Fix-potential-memory-leak.patch @@ -0,0 +1,38 @@ +From 5a148f4b94fb047c6bbf4cdbc54504207560e94c Mon Sep 17 00:00:00 2001 +From: Tomas Bzatek +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 + diff --git a/libblockdev.spec b/libblockdev.spec index 3702c18837b059a10b4c11df297ab7a8befb121d..574f2c058cbb19e7ed29cf89843771f0f16715af 100644 --- a/libblockdev.spec +++ b/libblockdev.spec @@ -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 - 3.0.4-7 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:nvme: Fix potential memory leak + * Tue Jun 25 2024 liuh - 3.0.4-6 - Type:bugfix - ID:NA