Fix leaking error

This commit is contained in:
yanshuai01 2024-05-11 11:10:31 +08:00
parent c380cf8900
commit 2ae95db460
2 changed files with 41 additions and 1 deletions

View File

@ -0,0 +1,33 @@
From 990b4136608ad1ae69e9727ccb16b9ecf88644e5 Mon Sep 17 00:00:00 2001
From: Tomas Bzatek <tbzatek@redhat.com>
Date: Mon, 20 Nov 2023 17:49:46 +0100
Subject: [PATCH] lvm-dbus: Fix leaking error
---
src/plugins/lvm-dbus.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/plugins/lvm-dbus.c b/src/plugins/lvm-dbus.c
index e822bd6..e1a9079 100644
--- a/src/plugins/lvm-dbus.c
+++ b/src/plugins/lvm-dbus.c
@@ -362,10 +362,14 @@ void bd_lvm_close (void) {
/* the check() call should create the DBus connection for us, but let's not
completely rely on it */
- if (!g_dbus_connection_flush_sync (bus, NULL, &error))
+ if (!g_dbus_connection_flush_sync (bus, NULL, &error)) {
bd_utils_log_format (BD_UTILS_LOG_CRIT, "Failed to flush DBus connection: %s", error->message);
- if (!g_dbus_connection_close_sync (bus, NULL, &error))
+ g_clear_error (&error);
+ }
+ if (!g_dbus_connection_close_sync (bus, NULL, &error)) {
bd_utils_log_format (BD_UTILS_LOG_CRIT, "Failed to close DBus connection: %s", error->message);
+ g_clear_error (&error);
+ }
dm_log_with_errno_init (NULL);
dm_log_init_verbose (0);
--
2.27.0

View File

@ -3,13 +3,14 @@
Name: libblockdev
Version: 3.0.4
Release: 4
Release: 5
Summary: libblockdev is a C library supporting GObject introspection for manipulation of block devices
License: LGPLv2+
URL: https://github.com/storaged-project/libblockdev
Source0: https://github.com/storaged-project/libblockdev/releases/download/%{version}-1/%{name}-%{version}.tar.gz
Patch1: 0001-Add-BDPluginSpec-constructor-and-use-it-in-plugin_sp.patch
Patch2: 0002-Fix-leaking-error.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
@ -159,6 +160,12 @@ find %{buildroot} -type f -name "*.la" | xargs %{__rm}
%changelog
* Sat May 11 2024 yanshuai <yanshuai@kylinos.cn> - 3.0.4-5
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:lvm-dbus: Fix leaking error
* Wed Apr 3 2024 wangzhiqiang <swangzhiqiang95@huawei.com> - 3.0.4-4
- Type:bugfix
- ID:NA