chantra / rpms / rpm

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