diff options
| author | Naveen Kumar Chaudhary <[email protected]> | 2026-07-10 20:50:40 +0530 |
|---|---|---|
| committer | Jerome Forissier <[email protected]> | 2026-07-23 17:05:20 +0200 |
| commit | 2e7e0dbb1594bcb909d369be92a951b17e511a31 (patch) | |
| tree | 206a6b14215449d022a8e325154740f1f12abcb2 | |
| parent | 02154ba0367a4baebf5dc72fa1a419d516f242a6 (diff) | |
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 <[email protected]>
Reviewed-by: Jerome Forissier <[email protected]>
| -rw-r--r-- | cmd/lwip/sntp.c | 1 |
1 files changed, 1 insertions, 0 deletions
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; } } |
