From 2e7e0dbb1594bcb909d369be92a951b17e511a31 Mon Sep 17 00:00:00 2001 From: Naveen Kumar Chaudhary Date: Fri, 10 Jul 2026 20:50:40 +0530 Subject: cmd: lwip: sntp: fix netif leak when ntpserverip is unset sntp_loop() allocates a netif via net_lwip_new_netif() and normally releases it with net_lwip_remove_netif() before returning. The error path taken when no explicit server IP is passed and ntp_server_known() is false returns -1 directly without freeing the netif, leaking the lwIP netif structure (and its associated state) on every failed invocation of the sntp command. Call net_lwip_remove_netif(netif) before returning on this path so it matches the other exits. Signed-off-by: Naveen Kumar Chaudhary Reviewed-by: Jerome Forissier --- cmd/lwip/sntp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/lwip/sntp.c b/cmd/lwip/sntp.c index 5fa400b104a..584151ba7d1 100644 --- a/cmd/lwip/sntp.c +++ b/cmd/lwip/sntp.c @@ -71,6 +71,7 @@ static int sntp_loop(struct udevice *udev, ip_addr_t *srvip) } else { if (!ntp_server_known()) { log_err("error: ntpserverip not set\n"); + net_lwip_remove_netif(netif); return -1; } } -- cgit v1.3.1