From: Darren Kenny <darren.ke...@oracle.com>

The static code analysis tool, Parfait, reported that the valid of
file->data was left referencing memory that was freed by the call to
grub_free(data) where data was initialized from file->data.

To ensure that there is no unintentional access to this memory
referenced by file->data we should set the pointer to NULL.

Signed-off-by: Darren Kenny <darren.ke...@oracle.com>
Reviewed-by: Daniel Kiper <daniel.ki...@oracle.com>
---
 grub-core/net/tftp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c
index 7e659a78b..1f3793ed8 100644
--- a/grub-core/net/tftp.c
+++ b/grub-core/net/tftp.c
@@ -442,6 +442,7 @@ tftp_close (struct grub_file *file)
       grub_net_udp_close (data->sock);
     }
   grub_free (data);
+  file->data = NULL;
   return GRUB_ERR_NONE;
 }
 
-- 
2.11.0


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

Reply via email to