bus_open leak sd_event_source when udevadm trigger。
authorven <2988994+hexiaowen@users.noreply.github.com>
Wed, 22 May 2019 06:24:28 +0000 (14:24 +0800)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 22 May 2019 08:44:34 +0000 (10:44 +0200)
On my host, when executing the udevadm trigger, I only receive the change event, which causes memleak

src/login/logind-button.c

index daffbf0..1624a31 100644 (file)
@@ -341,7 +341,8 @@ int button_open(Button *b) {
         }
 
         (void) button_set_mask(b);
-
+        
+        b->io_event_source = sd_event_source_unref(b->io_event_source);
         r = sd_event_add_io(b->manager->event, &b->io_event_source, b->fd, EPOLLIN, button_dispatch, b);
         if (r < 0) {
                 log_error_errno(r, "Failed to add button event: %m");