[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] net: don't free uninitialized sockets in dns

From: Andrei Borzenkov
Subject: Re: [PATCH] net: don't free uninitialized sockets in dns
Date: Sat, 10 Oct 2015 10:03:56 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0


19.08.2015 19:36, Andrei Borzenkov пишет:
18.08.2015 21:03, 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

We can avoid having holes to start with. Could you test attached patch?

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 (;
    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);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]