[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] net: don't free uninitialized sockets in dns
From: |
Josef Bacik |
Subject: |
[PATCH] net: don't free uninitialized sockets in dns |
Date: |
Tue, 18 Aug 2015 11:03:43 -0700 |
If we cannot open a connection to our dns server we will have NULL sockets in
our array, so don't do the cleanup on any sockets that didn't get created.
Signed-off-by: Josef Bacik <address@hidden>
---
grub-core/net/dns.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/grub-core/net/dns.c b/grub-core/net/dns.c
index 9d0c8fc..c356318 100644
--- a/grub-core/net/dns.c
+++ b/grub-core/net/dns.c
@@ -601,7 +601,10 @@ grub_net_dns_lookup (const char *name,
grub_free (data.name);
grub_netbuff_free (nb);
for (j = 0; j < send_servers; j++)
- grub_net_udp_close (sockets[j]);
+ {
+ if (sockets[j])
+ grub_net_udp_close (sockets[j]);
+ }
grub_free (sockets);
--
1.8.1
- [PATCH] net: don't free uninitialized sockets in dns,
Josef Bacik <=