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 <darren.kenny@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
Darren Kenny 2021-02-19 17:12:23 +00:00 committed by Daniel Kiper
parent 03f2515ae0
commit 0cb838b281

View File

@ -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;
}