* grub-core/net/net.c (grub_net_fs_open): Free resources on failed open.
This commit is contained in:
parent
a370616293
commit
c7564b8e13
2 changed files with 19 additions and 1 deletions
|
@ -1,3 +1,7 @@
|
|||
2012-06-22 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/net/net.c (grub_net_fs_open): Free resources on failed open.
|
||||
|
||||
2012-06-22 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* tests/util/grub-shell.in: Fix a typo.
|
||||
|
|
|
@ -1280,10 +1280,24 @@ grub_net_fs_open (struct grub_file *file_out, const char *name)
|
|||
|
||||
err = file->device->net->protocol->open (file, name);
|
||||
if (err)
|
||||
{
|
||||
while (file->device->net->packs.first)
|
||||
{
|
||||
grub_netbuff_free (file->device->net->packs.first->nb);
|
||||
grub_net_remove_packet (file->device->net->packs.first);
|
||||
}
|
||||
grub_free (file->device->net->name);
|
||||
grub_free (file);
|
||||
return err;
|
||||
}
|
||||
bufio = grub_bufio_open (file, 32768);
|
||||
if (! bufio)
|
||||
{
|
||||
while (file->device->net->packs.first)
|
||||
{
|
||||
grub_netbuff_free (file->device->net->packs.first->nb);
|
||||
grub_net_remove_packet (file->device->net->packs.first);
|
||||
}
|
||||
file->device->net->protocol->close (file);
|
||||
grub_free (file->device->net->name);
|
||||
grub_free (file);
|
||||
|
|
Loading…
Reference in a new issue