From: Zbigniew Jędrzejewski-Szmek Date: Fri, 5 Jun 2020 12:07:44 +0000 (+0200) Subject: logind: fix possible memleak of message if the message was already in the set X-Git-Tag: v246-rc1~105^2~6 X-Git-Url: http://git-history.diyao.me/?a=commitdiff_plain;h=648c339c49398e9f1961399a672759ee2c7a9758;p=systemd%2F.git 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. --- 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;