The memory requested for the event is not released here,
causing memory leaks. This patch fixes this problem.

Signed-off-by: Jia Zhang <zhang....@linux.alibaba.com>
Signed-off-by: Tianjia Zhang <tianjia.zh...@linux.alibaba.com>
---
 grub-core/commands/efi/tpm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/grub-core/commands/efi/tpm.c b/grub-core/commands/efi/tpm.c
index 32909c192..6a6cd0d83 100644
--- a/grub-core/commands/efi/tpm.c
+++ b/grub-core/commands/efi/tpm.c
@@ -247,6 +247,7 @@ grub_tpm1_log_event (grub_efi_handle_t tpm_handle, unsigned 
char *buf,
   algorithm = TCG_ALG_SHA;
   status = efi_call_7 (tpm->log_extend_event, tpm, (grub_addr_t) buf, 
(grub_uint64_t) size,
                       algorithm, event, &eventnum, &lastevent);
+  grub_free (event);
 
   switch (status)
     {
@@ -297,6 +298,7 @@ grub_tpm2_log_event (grub_efi_handle_t tpm_handle, unsigned 
char *buf,
 
   status = efi_call_5 (tpm->hash_log_extend_event, tpm, 0, (grub_addr_t) buf,
                       (grub_uint64_t) size, event);
+  grub_free (event);
 
   switch (status)
     {
-- 
2.17.1


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to