+2013-04-12 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/net/http.c: Fix bad free.
+
2013-04-12 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/net/drivers/ieee1275/ofnet.c: Don't attempt to send more
if (data->sock)
grub_net_tcp_close (data->sock, GRUB_NET_TCP_ABORT);
+ data->sock = 0;
if (data->current_line)
grub_free (data->current_line);
- grub_free (data);
+ data->current_line = 0;
file->device->net->eof = 1;
file->device->net->stall = 1;
if (file->size == GRUB_FILE_SIZE_UNKNOWN)
http_data_t data = file->data;
grub_err_t err;
+ if (!data->sock)
+ {
+ grub_netbuff_free (nb);
+ return GRUB_ERR_NONE;
+ }
+
while (1)
{
char *ptr = (char *) nb->data;
grub_err_t err;
old_data = file->data;
/* FIXME: Reuse socket? */
- grub_net_tcp_close (old_data->sock, GRUB_NET_TCP_ABORT);
+ if (old_data->sock)
+ grub_net_tcp_close (old_data->sock, GRUB_NET_TCP_ABORT);
old_data->sock = 0;
while (file->device->net->packs.first)
if (!file->device->net->eof)
file->device->net->stall = 0;
- grub_net_tcp_unstall (data->sock);
+ if (data && data->sock)
+ grub_net_tcp_unstall (data->sock);
return 0;
}