]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
logind: fix possible memleak of message if the message was already in the set
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 5 Jun 2020 12:07:44 +0000 (14:07 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 24 Jun 2020 08:38:15 +0000 (10:38 +0200)
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

index 5c0c55fc3699887701b6fd057eac1c8a812d14f6..450ec320443a4cf63bc3b28a01e6b7ec3713a4df 100644 (file)
@@ -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;