Skip to contentSkip to conversation

tpm: fix memory leak

PATCH New Kylene Jo Hall 1 participant 1 message Apr 19, 2006 TPM device driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tpm: fix memory leak

The eventname was kmalloc'd and not freed in the *_show functions.

This bug was found by Coverity.

---
 drivers/char/tpm/tpm_bios.c |    2 ++
 1 files changed, 2 insertions(+)
drivers/char/tpm/tpm_bios.c +2 -0
@@ -320,6 +321,7 @@ static int tpm_binary_bios_measurements_
 	/* 5th: delimiter */
 	seq_putc(m, '\0');
 
+	kfree(eventname);
 	return 0;
 }
 
@@ -367,6 +369,7 @@ static int tpm_ascii_bios_measurements_s
 	/* 4th: eventname <= max + \'0' delimiter */
 	seq_printf(m, " %s\n", eventname);
 
+	kfree(eventname);
 	return 0;
 }