[PATCH] lib: fwts_microcode: fix leak of allocated microcode buffer

Colin King colin.king at canonical.com
Mon May 6 21:50:06 UTC 2013


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

Coverity CID #997340, Resource leak.

Need to free microcode buffer before we return.

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

diff --git a/src/lib/src/fwts_microcode.c b/src/lib/src/fwts_microcode.c
index fb81c0c..0bcbc4b 100644
--- a/src/lib/src/fwts_microcode.c
+++ b/src/lib/src/fwts_microcode.c
@@ -54,6 +54,7 @@ int fwts_update_microcode(fwts_framework *fw, const char *device, const char *fi
 
 	if ((fp = fopen(filename, "r")) == NULL) {
 		fwts_log_error(fw, "Cannot open source '%s'.", filename);
+		free(microcode);
 		return FWTS_ERROR;
 	}
 
-- 
1.8.1.2




More information about the fwts-devel mailing list