From 648c339c49398e9f1961399a672759ee2c7a9758 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 5 Jun 2020 14:07:44 +0200 Subject: [PATCH] logind: fix possible memleak of message if the message was already in the set I'm not sure if it is actually possible to encounter this condition. But let's make the handling correct regardless. --- src/login/logind-brightness.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/login/logind-brightness.c b/src/login/logind-brightness.c index 5c0c55fc36..450ec32044 100644 --- a/src/login/logind-brightness.c +++ b/src/login/logind-brightness.c @@ -175,9 +175,8 @@ static int set_add_message(Set **set, sd_bus_message *message) { return r; r = set_ensure_put(set, &bus_message_hash_ops, message); - if (r < 0) + if (r <= 0) return r; - sd_bus_message_ref(message); return 1;