From: Danylo Vodopianov <dvo-...@napatech.com>

p_fpga_mgr is properly freed when it's no longer needed

CID 440546: Resource leak (RESOURCE_LEAK)
Fixes: ddf184d0b6c2 ("net/ntnic: add FPGA initialization")

Signed-off-by: Danylo Vodopianov <dvo-...@napatech.com>
---
 drivers/net/ntnic/nthw/core/nthw_fpga.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ntnic/nthw/core/nthw_fpga.c 
b/drivers/net/ntnic/nthw/core/nthw_fpga.c
index ca69a9d5b1..88641145ec 100644
--- a/drivers/net/ntnic/nthw/core/nthw_fpga.c
+++ b/drivers/net/ntnic/nthw/core/nthw_fpga.c
@@ -230,6 +230,8 @@ int nthw_fpga_init(struct fpga_info_s *p_fpga_info)
                if (p_fpga == NULL) {
                        NT_LOG(ERR, NTHW, "%s: Unsupported FPGA: %s (%08X)", 
p_adapter_id_str,
                                s_fpga_prod_ver_rev_str, 
p_fpga_info->n_fpga_build_time);
+                       nthw_fpga_mgr_delete(p_fpga_mgr);
+                       p_fpga_mgr = NULL;
                        return -1;
                }
 
-- 
2.45.0

Reply via email to