Received: from list by lists.gnu.org with archive (Exim 4.71) id 1ZRlEl-000590-Qp for mharc-grub-devel@gnu.org; Tue, 18 Aug 2015 14:03:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43210) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZRlEj-00055j-BH for grub-devel@gnu.org; Tue, 18 Aug 2015 14:03:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZRlEg-0002bk-12 for grub-devel@gnu.org; Tue, 18 Aug 2015 14:03:49 -0400 Received: from 66-220-155-178.intmwg.facebook.com ([66.220.155.178]:40559 helo=mx-out.facebook.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZRlEf-0002be-T8 for grub-devel@gnu.org; Tue, 18 Aug 2015 14:03:45 -0400 Received: from facebook.com (2401:db00:2040:5012:face:0:9:0) by mx-out.facebook.com (10.212.232.63) with ESMTP id 77c2d25c45d311e58f210002c992ebde-88ab16b0 for ; Tue, 18 Aug 2015 11:03:45 -0700 Received: by devbig041.ash4.facebook.com (Postfix, from userid 8730) id 4669E4542089; Tue, 18 Aug 2015 11:03:45 -0700 (PDT) From: Josef Bacik To: kernel-team@fb.com, grub-devel@gnu.org Subject: [PATCH] net: don't free uninitialized sockets in dns Date: Tue, 18 Aug 2015 11:03:43 -0700 Message-Id: <1439921023-3547412-1-git-send-email-jbacik@fb.com> X-Mailer: git-send-email 1.8.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 66.220.155.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: Tue, 18 Aug 2015 18:03:50 -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 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