mirror of
https://github.com/clearlinux/systemd-stable.git
synced 2026-10-04 15:58:29 +00:00
bus: unref buscreds on failure
Actually unref the buscreds when we are not going to return a pointer to them. As when bus_creds_add_more fails we immediately return the error code otherwise and leak the new buscreds. Found with coverity. Fixes: CID#1237761
This commit is contained in:
committed by
David Herrmann
parent
b67ddc7bbe
commit
2b347169b9
@@ -3339,8 +3339,10 @@ _public_ int sd_bus_get_peer_creds(sd_bus *bus, uint64_t mask, sd_bus_creds **re
|
||||
}
|
||||
|
||||
r = bus_creds_add_more(c, mask, pid, 0);
|
||||
if (r < 0)
|
||||
if (r < 0) {
|
||||
sd_bus_creds_unref(c);
|
||||
return r;
|
||||
}
|
||||
|
||||
*ret = c;
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user