chantra / rpms / rpm

Forked from rpms/rpm 2 years ago
Clone
83a7c7
From d5f201345f6d27b6280750e5c6502f4418614fbc Mon Sep 17 00:00:00 2001
83a7c7
From: Panu Matilainen <pmatilai@redhat.com>
83a7c7
Date: Wed, 29 May 2019 12:09:20 +0300
83a7c7
Subject: [PATCH] Fully shutdown DBUS on systemd_inhibit cleanup
83a7c7
 (RhBug:1714657)
83a7c7
83a7c7
dbus_shutdown() frees internal DBUS memory allocations that will otherwise
83a7c7
show up as memory leaks. This is of little consequence in practise
83a7c7
but shuts up valgrind...
83a7c7
---
83a7c7
 plugins/systemd_inhibit.c | 6 ++++++
83a7c7
 1 file changed, 6 insertions(+)
83a7c7
83a7c7
diff --git a/plugins/systemd_inhibit.c b/plugins/systemd_inhibit.c
83a7c7
index e2cbcffbb..0628188ba 100644
83a7c7
--- a/plugins/systemd_inhibit.c
83a7c7
+++ b/plugins/systemd_inhibit.c
83a7c7
@@ -80,6 +80,11 @@ static rpmRC systemd_inhibit_init(rpmPlugin plugin, rpmts ts)
83a7c7
     return RPMRC_NOTFOUND;
83a7c7
 }
83a7c7
 
83a7c7
+static void systemd_inhibit_cleanup(rpmPlugin plugin)
83a7c7
+{
83a7c7
+    dbus_shutdown();
83a7c7
+}
83a7c7
+
83a7c7
 static rpmRC systemd_inhibit_tsm_pre(rpmPlugin plugin, rpmts ts)
83a7c7
 {
83a7c7
     if (rpmtsFlags(ts) & (RPMTRANS_FLAG_TEST|RPMTRANS_FLAG_BUILD_PROBS))
83a7c7
@@ -106,6 +111,7 @@ static rpmRC systemd_inhibit_tsm_post(rpmPlugin plugin, rpmts ts, int res)
83a7c7
 
83a7c7
 struct rpmPluginHooks_s systemd_inhibit_hooks = {
83a7c7
     .init = systemd_inhibit_init,
83a7c7
+    .cleanup = systemd_inhibit_cleanup,
83a7c7
     .tsm_pre = systemd_inhibit_tsm_pre,
83a7c7
     .tsm_post = systemd_inhibit_tsm_post,
83a7c7
 };
83a7c7
-- 
83a7c7
2.21.0
83a7c7