[PATCH] tpm: fix memory leak
authorKylene Jo Hall <kjhall@us.ibm.com>
Sat, 22 Apr 2006 09:36:35 +0000 (02:36 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Sat, 22 Apr 2006 16:19:53 +0000 (09:19 -0700)
The eventname was kmalloc'd and not freed in the *_show functions.

This bug was found by Coverity.

Signed-off-by: Kylene Hall <kjhall@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/char/tpm/tpm_bios.c

index 537aa45..0549e2a 100644 (file)
@@ -306,6 +306,7 @@ static int tpm_binary_bios_measurements_show(struct seq_file *m, void *v)
        /* 5th: delimiter */
        seq_putc(m, '\0');
 
+       kfree(eventname);
        return 0;
 }
 
@@ -353,6 +354,7 @@ static int tpm_ascii_bios_measurements_show(struct seq_file *m, void *v)
        /* 4th: eventname <= max + \'0' delimiter */
        seq_printf(m, " %s\n", eventname);
 
+       kfree(eventname);
        return 0;
 }