From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1aTd4M-0001po-Le for mharc-grub-devel@gnu.org; Wed, 10 Feb 2016 17:17:06 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60421) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTd4I-0001la-6S for grub-devel@gnu.org; Wed, 10 Feb 2016 17:17:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aTd4E-0003fQ-Do for grub-devel@gnu.org; Wed, 10 Feb 2016 17:17:02 -0500 Received: from 66-220-144-178.intmgw.facebook.com ([66.220.144.178]:44295 helo=mx-out.facebook.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTd4E-0003fJ-79 for grub-devel@gnu.org; Wed, 10 Feb 2016 17:16:58 -0500 Received: from facebook.com (2401:db00:2040:5012:face:0:9:0) by mx-out.facebook.com (10.102.107.97) with ESMTP id 0cfa97ead03c11e5b7800002c99331b0-ffcef270 for ; Wed, 10 Feb 2016 13:20:04 -0800 Received: by devbig041.ash4.facebook.com (Postfix, from userid 8730) id 7CB184540A7D; Wed, 10 Feb 2016 13:21:10 -0800 (PST) From: Josef Bacik To: grub-devel@gnu.org, kernel-team@fb.com Subject: [PATCH 05/14] net: don't free uninitialized sockets in dns Date: Wed, 10 Feb 2016 13:20:59 -0800 Message-Id: <1455139268-3241273-6-git-send-email-jbacik@fb.com> X-Mailer: git-send-email 1.8.1 In-Reply-To: <1455139268-3241273-1-git-send-email-jbacik@fb.com> References: <1455139268-3241273-1-git-send-email-jbacik@fb.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 66.220.144.178 Cc: Josef Bacik X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Feb 2016 22:17:05 -0000 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 --- 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 89741dd..82a3307 100644 --- a/grub-core/net/dns.c +++ b/grub-core/net/dns.c @@ -598,7 +598,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