From abe571d32c87499370d69214f3fee5182741e9bb Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Sun, 1 Mar 2026 05:08:09 +0100 Subject: [PATCH] confd: silence Coverity false positive resource leak Signed-off-by: Joachim Wiberg --- src/confd/src/hardware.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/confd/src/hardware.c b/src/confd/src/hardware.c index 5857ceb1..73c11c8c 100644 --- a/src/confd/src/hardware.c +++ b/src/confd/src/hardware.c @@ -695,18 +695,17 @@ int hardware_change(sr_session_ctx_t *session, struct lyd_node *config, struct l wifi_find_interfaces_on_radio(interfaces_config, name, &wifi_iface_list, &wifi_iface_count); - - if (!wifi_iface_count) - continue; - - /* Generate AP config (hostapd) for all APs on this radio */ - rc = wifi_gen_aps_on_radio(name, interfaces_config, cwifi_radio, config); - if (rc != SR_ERR_OK) - ERROR("Failed to generate AP config for radio %s", name); - /* Free the interface list */ - free(wifi_iface_list); - wifi_iface_list = NULL; - wifi_iface_count = 0; + if (wifi_iface_list) { + if (wifi_iface_count) { + /* Generate AP config (hostapd) for all APs on this radio */ + rc = wifi_gen_aps_on_radio(name, interfaces_config, cwifi_radio, config); + if (rc != SR_ERR_OK) + ERROR("Failed to generate AP config for radio %s", name); + } + free(wifi_iface_list); + wifi_iface_list = NULL; + wifi_iface_count = 0; + } } else if (!strcmp(class, "infix-hardware:gps")) { if (event != SR_EV_DONE) continue;