From: Darren Kenny Date: Fri, 19 Feb 2021 17:12:23 +0000 (+0000) Subject: net/tftp: Fix dangling memory pointer X-Git-Tag: grub-2.06-rc1~124 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0cb838b281a68b536a09681f9557ea6a7ac5da7a;p=thirdparty%2Fgrub.git net/tftp: Fix dangling memory pointer 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 Reviewed-by: Daniel Kiper --- 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; }