[PATCH 3/5] lib: fwts_olog: fix memory leak on buffer on error exit path

Colin King colin.king at canonical.com
Sat Apr 2 17:52:02 UTC 2016


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

CovertyScan detected a memory leak on buffer, free the buffer on the
error exit path

Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/lib/src/fwts_olog.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/lib/src/fwts_olog.c b/src/lib/src/fwts_olog.c
index 62526ce..a685d70 100644
--- a/src/lib/src/fwts_olog.c
+++ b/src/lib/src/fwts_olog.c
@@ -94,6 +94,7 @@ fwts_list *fwts_olog_read(fwts_framework *fw)
 
 	if (!(msglog_outfile_f = fopen(msglog_outfile, "w"))) {
 		/* create the output file for the sysfs msglog */
+		free(buffer);
 		goto olog_cleanup_msglog;
 	}
 
-- 
2.7.4




More information about the fwts-devel mailing list