diff mbox series

opal: fix the resource leak for cpus

Message ID 20240318084813.113005-2-ivan.hu@canonical.com
State Accepted
Headers show
Series opal: fix the resource leak for cpus | expand

Commit Message

Ivan Hu March 18, 2024, 8:48 a.m. UTC
BugLink: https://bugs.launchpad.net/fwts/+bug/2058217

Fix resource leak found by coverity,
CID 323867: (#1 of 1): Resource leak (RESOURCE_LEAK)
25. leaked_storage: Variable cpus going out of scope
leaks the storage it points to.

Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
---
 src/opal/cpu_info.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/src/opal/cpu_info.c b/src/opal/cpu_info.c
index c96a419a..10c3c4ed 100644
--- a/src/opal/cpu_info.c
+++ b/src/opal/cpu_info.c
@@ -203,9 +203,9 @@  static int get_linux_xscom_devices(fwts_framework *fw)
 				failures++;
 			}
 			fwts_log_nl(fw);
-			free(cpus);
 			free(namelist[i]);
 		}
+		free(cpus);
 	}
 	free(namelist);