[PATCH 03/10] pci: crs: fix memory leak on cmdline

Colin King colin.king at canonical.com
Thu May 1 14:01:14 UTC 2014


From: Colin Ian King <colin.king at canonical.com>

Coverity Scan detected a memort leak on cmdline on an error
exit path.  Free the cmdline to stop the leak.

Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/pci/crs/crs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/pci/crs/crs.c b/src/pci/crs/crs.c
index 4396598..d6e29a1 100644
--- a/src/pci/crs/crs.c
+++ b/src/pci/crs/crs.c
@@ -52,11 +52,13 @@ static int crs_test1(fwts_framework *fw)
 
 	if (crs_get_bios_date(fw, &day, &mon, &year) != FWTS_OK) {
 		fwts_log_error(fw, "Cannot determine age of BIOS.");
+		free(cmdline);
 		return FWTS_ERROR;
 	}
 
 	if ((klog = fwts_klog_read()) == NULL) {
 		fwts_log_error(fw, "Cannot read kernel log.");
+		free(cmdline);
 		return FWTS_ERROR;
 	}
 
-- 
2.0.0.rc0




More information about the fwts-devel mailing list