From 2333154a2b81bcb9dbf034ad004d975561e8b79d Mon Sep 17 00:00:00 2001 From: Umut Tezduyar Lindskog Date: Thu, 20 Feb 2014 21:04:03 +0100 Subject: [PATCH 1/1] sd-dhcp-client: prevent timer related memory leaks --- src/libsystemd-dhcp/sd-dhcp-client.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libsystemd-dhcp/sd-dhcp-client.c b/src/libsystemd-dhcp/sd-dhcp-client.c index ec2b53ffe..53abe2225 100644 --- a/src/libsystemd-dhcp/sd-dhcp-client.c +++ b/src/libsystemd-dhcp/sd-dhcp-client.c @@ -392,6 +392,8 @@ static int client_timeout_resend(sd_event_source *s, uint64_t usec, next_timeout += (random_u32() & 0x1fffff); + client->timeout_resend = sd_event_source_unref(client->timeout_resend); + r = sd_event_add_monotonic(client->event, &client->timeout_resend, next_timeout, @@ -477,6 +479,8 @@ static int client_initialize_events(sd_dhcp_client *client, if (r < 0) goto error; + client->timeout_resend = sd_event_source_unref(client->timeout_resend); + r = sd_event_add_monotonic(client->event, &client->timeout_resend, usec, 0, -- 2.30.2