Fix memory leak when using --dhcp-optsfile with DHCPv6 options.

This commit is contained in:
renmingshuai
2023-09-30 23:31:08 +01:00
committed by Simon Kelley
parent 768b45a023
commit d16b995756

View File

@@ -5734,11 +5734,11 @@ static void clear_dynamic_conf(void)
} }
} }
static void clear_dynamic_opt(void) static void clear_dhcp_opt(struct dhcp_opt **dhcp_opts)
{ {
struct dhcp_opt *opts, *cp, **up; struct dhcp_opt *opts, *cp, **up;
for (up = &daemon->dhcp_opts, opts = daemon->dhcp_opts; opts; opts = cp) for (up = dhcp_opts, opts = *dhcp_opts; opts; opts = cp)
{ {
cp = opts->next; cp = opts->next;
@@ -5752,6 +5752,14 @@ static void clear_dynamic_opt(void)
} }
} }
static void clear_dynamic_opt(void)
{
clear_dhcp_opt(&daemon->dhcp_opts);
#ifdef HAVE_DHCP6
clear_dhcp_opt(&daemon->dhcp_opts6);
#endif
}
void reread_dhcp(void) void reread_dhcp(void)
{ {
struct hostsfile *hf; struct hostsfile *hf;