[systemd-devel] [systemd-commits] 2 commits - src/libsystemd-network

Lennart Poettering lennart at poettering.net
Mon Apr 20 11:34:44 PDT 2015


On Tue, 14.04.15 09:33, Thomas H.P. Andersen (phomes at kemper.freedesktop.org) wrote:

>  src/libsystemd-network/sd-dhcp6-client.c   |    2 ++
>  src/libsystemd-network/test-dhcp6-client.c |    2 --
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> New commits:
> commit 70c79983e1abae17c46969b024d0b9e6a3b83d00
> Author: Thomas Hindoe Paaboel Andersen <phomes at gmail.com>
> Date:   Tue Apr 14 18:24:00 2015 +0200
> 
>     test-dhcp6-client: don't unref the event twice
> 
> diff --git a/src/libsystemd-network/test-dhcp6-client.c b/src/libsystemd-network/test-dhcp6-client.c
> index 9386f31..7618547 100644
> --- a/src/libsystemd-network/test-dhcp6-client.c
> +++ b/src/libsystemd-network/test-dhcp6-client.c
> @@ -701,7 +701,5 @@ int main(int argc, char *argv[]) {
>          test_advertise_option(e);
>          test_client_solicit(e);
>  
> -        assert_se(!sd_event_unref(e));
> -
>          return 0;
>  }
> 
> commit 8283c71b7141afc6ad69dc7913311aa01e8221dd
> Author: Thomas Hindoe Paaboel Andersen <phomes at gmail.com>
> Date:   Tue Apr 14 18:02:15 2015 +0200
> 
>     sd-dhcp6-client: unref lease when freeing the client
> 
> diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
> index 9d88d46..cd33237 100644
> --- a/src/libsystemd-network/sd-dhcp6-client.c
> +++ b/src/libsystemd-network/sd-dhcp6-client.c
> @@ -1205,6 +1205,8 @@ sd_dhcp6_client *sd_dhcp6_client_unref(sd_dhcp6_client *client) {
>                  client_reset(client);
>  
>                  sd_dhcp6_client_detach_event(client);
> +                if (client->lease)
> +                        sd_dhcp6_lease_unref(client->lease);


A quick note: our destructor functions should all accept NULL as
parameter and then become NOPs. sd_dhcp6_lease_unref() does that
correctly, and hence makes the explicit if check by the caller
unnecessary.

Will fix. Will also add a note to CODING_STYLE about this.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list