daandemeyer / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
7e7c9f
From b88483b804e92a59800e8785c87d17a7213aafc4 Mon Sep 17 00:00:00 2001
7e7c9f
From: ven <2988994+hexiaowen@users.noreply.github.com>
7e7c9f
Date: Wed, 22 May 2019 14:24:28 +0800
7e7c9f
Subject: [PATCH] =?UTF-8?q?bus=5Fopen=20leak=20sd=5Fevent=5Fsource=20when?=
7e7c9f
 =?UTF-8?q?=20udevadm=20trigger=E3=80=82?=
7e7c9f
MIME-Version: 1.0
7e7c9f
Content-Type: text/plain; charset=UTF-8
7e7c9f
Content-Transfer-Encoding: 8bit
7e7c9f
7e7c9f
On my host, when executing the udevadm trigger, I only receive the change event, which causes memleak
7e7c9f
7e7c9f
(cherry picked from commit b2774a3ae692113e1f47a336a6c09bac9cfb49ad)
7e7c9f
7e7c9f
Resolves: #1798503
7e7c9f
---
7e7c9f
 src/login/logind-button.c | 1 +
7e7c9f
 1 file changed, 1 insertion(+)
7e7c9f
7e7c9f
diff --git a/src/login/logind-button.c b/src/login/logind-button.c
7e7c9f
index d7211e66ce..9145176e58 100644
7e7c9f
--- a/src/login/logind-button.c
7e7c9f
+++ b/src/login/logind-button.c
7e7c9f
@@ -259,6 +259,7 @@ int button_open(Button *b) {
7e7c9f
                 goto fail;
7e7c9f
         }
7e7c9f
 
7e7c9f
+        b->io_event_source = sd_event_source_unref(b->io_event_source);
7e7c9f
         r = sd_event_add_io(b->manager->event, &b->io_event_source, b->fd, EPOLLIN, button_dispatch, b);
7e7c9f
         if (r < 0) {
7e7c9f
                 log_error_errno(r, "Failed to add button event: %m");