diff options
-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 4b26ce48189b..8677fc6a545e 100644 --- a/drivers/char/tpm/tpm_bios.c +++ b/drivers/char/tpm/tpm_bios.c | |||
@@ -465,7 +465,7 @@ static int tpm_binary_bios_measurements_open(struct inode *inode, | |||
465 | return -ENOMEM; | 465 | return -ENOMEM; |
466 | 466 | ||
467 | if ((err = read_log(log))) | 467 | if ((err = read_log(log))) |
468 | return err; | 468 | goto out_free; |
469 | 469 | ||
470 | /* now register seq file */ | 470 | /* now register seq file */ |
471 | err = seq_open(file, &tpm_binary_b_measurments_seqops); | 471 | err = seq_open(file, &tpm_binary_b_measurments_seqops); |
@@ -473,10 +473,15 @@ static int tpm_binary_bios_measurements_open(struct inode *inode, | |||
473 | seq = file->private_data; | 473 | seq = file->private_data; |
474 | seq->private = log; | 474 | seq->private = log; |
475 | } else { | 475 | } else { |
476 | kfree(log->bios_event_log); | 476 | goto out_free; |
477 | kfree(log); | ||
478 | } | 477 | } |
478 | |||
479 | out: | ||
479 | return err; | 480 | return err; |
481 | out_free: | ||
482 | kfree(log->bios_event_log); | ||
483 | kfree(log); | ||
484 | goto out; | ||
480 | } | 485 | } |
481 | 486 | ||
482 | const struct file_operations tpm_binary_bios_measurements_ops = { | 487 | const struct file_operations tpm_binary_bios_measurements_ops = { |