diff mbox

[1/4] xc3082: Fix use after free in free_firmware()

Message ID 1374757774-29051-2-git-send-email-gjasny@googlemail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Gregor Jasny July 25, 2013, 1:09 p.m. UTC
Detected by Coverity Scanner.

CC: Mauro Carvalho Chehab <mchehab@infradead.org>
Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
---
 utils/xc3028-firmware/firmware-tool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/utils/xc3028-firmware/firmware-tool.c b/utils/xc3028-firmware/firmware-tool.c
index b2e9de4..a7850df 100644
--- a/utils/xc3028-firmware/firmware-tool.c
+++ b/utils/xc3028-firmware/firmware-tool.c
@@ -86,13 +86,13 @@  static struct firmware* alloc_firmware(void) {
 
 static void free_firmware(struct firmware *f) {
 	free(f->name);
-	free(f->desc);
 	if(f->desc) {
 		unsigned int i = 0;
 		for(i = 0; i < f->nr_desc; ++ i) {
 			free(f->desc[i].data);
 		}
 	}
+	free(f->desc);
 	free(f);
 }