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.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2020-06-05 14:07:44 +02:00
parent d378ef708b
commit 648c339c49
1 changed files with 1 additions and 2 deletions

View 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;