diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c index da5312c5ff..8115595dc5 100644 --- a/src/network/networkd-ndisc.c +++ b/src/network/networkd-ndisc.c @@ -734,7 +734,7 @@ static int ndisc_router_process_captive_portal(Link *link, sd_ndisc_router *rt) return r; if (len == 0) { - mfree(link->ndisc_captive_portal); + link->ndisc_captive_portal = mfree(link->ndisc_captive_portal); return 0; } @@ -743,7 +743,7 @@ static int ndisc_router_process_captive_portal(Link *link, sd_ndisc_router *rt) return r; if (!in_charset(captive_portal, URI_VALID)) - return -EINVAL; + return -EBADMSG; if (!streq_ptr(link->ndisc_captive_portal, captive_portal)) { free_and_replace(link->ndisc_captive_portal, captive_portal);