grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: don't free uninitialized sockets in dns
@ 2015-08-18 18:03 Josef Bacik
  2015-08-19 16:36 ` Andrei Borzenkov
  0 siblings, 1 reply; 4+ messages in thread
From: Josef Bacik @ 2015-08-18 18:03 UTC (permalink / raw)
  To: kernel-team, grub-devel; +Cc: Josef Bacik

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 <jbacik@fb.com>
---
 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



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-10-12 15:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-18 18:03 [PATCH] net: don't free uninitialized sockets in dns Josef Bacik
2015-08-19 16:36 ` Andrei Borzenkov
2015-10-10  7:03   ` Andrei Borzenkov
2015-10-12 15:02     ` Josef Bacik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).