device: fix memleak for ndisc_search->domain in ndisc_set_router_config()

It is a bit fragile not to clone the string because we depend on
nm_ip6_config_get_search(priv->ip6_config) to be stable.

In practice, it's no problem. Saves an additional strdup and the
effort to cleanup the memory afterwards.
This commit is contained in:
Thomas Haller 2016-11-10 10:03:59 +01:00
parent b058c45d28
commit 60be9cbc9e

View file

@ -1875,7 +1875,7 @@ ndisc_set_router_config (NMNDisc *ndisc, NMDevice *self)
NMNDiscDNSDomain *ndisc_search;
ndisc_search = &g_array_index (dns_domains, NMNDiscDNSDomain, i);
ndisc_search->domain = g_strdup (search);
ndisc_search->domain = (char *) search;
ndisc_search->timestamp = now;
ndisc_search->lifetime = NM_NDISC_ROUTER_LIFETIME;
}