[systemd-devel] question about sd_bus_slot_unref()
Jakub Sitnicki
jsitnicki at gmail.com
Tue Sep 1 01:47:36 PDT 2015
Hi Li,
On Tue, Sep 01, 2015 at 06:56 AM CEST, eshark <eshark77 at 163.com> wrote:
> I wonder why the sd_bus_slot_unref() always returns NULL? I expect
> that I can check whether the slot->n_ref ==0 by checking its return
> value.
It is my understanding that NULL is returned so that you can release the
reference and nullify the pointer holding the reference in one line:
ref = sd_bus_slot_unref(ref);
This idiom prevents the access-after-release programming errors.
Cheers,
Jakub
More information about the systemd-devel
mailing list