diff options
author | Jesper Juhl <jesper.juhl@gmail.com> | 2007-07-20 09:31:48 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-20 17:44:20 +0200 |
commit | 178554ae75739e91dc4d7c3e42a3db95448cc5bf (patch) | |
tree | 12c9ec848b2c6b463c4f12801e802ee75ff31311 /drivers/char/tpm | |
parent | m68knommu: reformat show_cpuinfo() (diff) | |
download | linux-178554ae75739e91dc4d7c3e42a3db95448cc5bf.tar.xz linux-178554ae75739e91dc4d7c3e42a3db95448cc5bf.zip |
Memory leak in tpm_ascii_bios_measurements_open()
Coverity found a memory leak in tpm_ascii_bios_measurements_open().
If "read_log(log)" fails, then we may leak 'log' and
'log->bios_event_log'.
Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Cc: Seiji Munetoh <munetoh@jp.ibm.com>
Cc: Stefan Berger <stefanb@us.ibm.com>
Cc: Reiner Sailer <sailer@watson.ibm.com>
Cc: Kylene Hall <kjhall@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/tpm')
-rw-r--r-- | drivers/char/tpm/tpm_bios.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/char/tpm/tpm_bios.c b/drivers/char/tpm/tpm_bios.c index 4eba32b23b29..4b26ce48189b 100644 --- a/drivers/char/tpm/tpm_bios.c +++ b/drivers/char/tpm/tpm_bios.c @@ -427,7 +427,7 @@ static int tpm_ascii_bios_measurements_open(struct inode *inode, return -ENOMEM; if ((err = read_log(log))) - return err; + goto out_free; /* now register seq file */ err = seq_open(file, &tpm_ascii_b_measurments_seqops); @@ -435,10 +435,15 @@ static int tpm_ascii_bios_measurements_open(struct inode *inode, seq = file->private_data; seq->private = log; } else { - kfree(log->bios_event_log); - kfree(log); + goto out_free; } + +out: return err; +out_free: + kfree(log->bios_event_log); + kfree(log); + goto out; } const struct file_operations tpm_ascii_bios_measurements_ops = { |