[systemd-devel] [PATCH] dd-dhcp-server: fix a leak
Thomas H.P. Andersen
phomes at gmail.com
Wed Jun 18 14:49:49 PDT 2014
On Fri, Jun 13, 2014 at 10:58 PM, Thomas H.P. Andersen <phomes at gmail.com> wrote:
> From: Thomas Hindoe Paaboel Andersen <phomes at gmail.com>
>
> We must use free instead of dhcp_lease_free here to avoid freeing
> client_id.data.
> ---
> src/libsystemd-network/sd-dhcp-server.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/libsystemd-network/sd-dhcp-server.c b/src/libsystemd-network/sd-dhcp-server.c
> index 17c19cc..38f93c1 100644
> --- a/src/libsystemd-network/sd-dhcp-server.c
> +++ b/src/libsystemd-network/sd-dhcp-server.c
> @@ -694,8 +694,10 @@ int dhcp_server_handle_message(sd_dhcp_server *server, DHCPMessage *message,
> lease->address = req->requested_ip;
> lease->client_id.data = memdup(req->client_id.data,
> req->client_id.length);
> - if (!lease->client_id.data)
> + if (!lease->client_id.data) {
> + free(lease);
> return -ENOMEM;
> + }
> lease->client_id.length = req->client_id.length;
> } else
> lease = existing_lease;
> --
> 1.9.3
>
I ended up committing this one directly with a some other patches.
More information about the systemd-devel
mailing list