r25043: Avoid allocation on with NULL parent.
authorJelmer Vernooij <jelmer@samba.org>
Sun, 9 Sep 2007 01:08:50 +0000 (01:08 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 20:05:47 +0000 (15:05 -0500)
(This used to be commit 3f30cd5688a532a2d6c4d970c2bc759efa2a1b04)

source4/lib/socket/interface.c

index 00b1f6c63554cab020606f48ca64481d3ac5a946..992476fe2234c50821549f216545a342f9dc8c25 100644 (file)
@@ -75,12 +75,13 @@ static void add_interface(struct in_addr ip, struct in_addr nmask)
 {
        struct interface *iface;
        struct ipv4_addr bcast;
-       if (iface_find(ip, False)) {
+
+       if (iface_find(ip, false)) {
                DEBUG(3,("not adding duplicate interface %s\n",inet_ntoa(ip)));
                return;
        }
 
-       iface = talloc(local_interfaces, struct interface);
+       iface = talloc(local_interfaces == NULL ? talloc_autofree_context() : local_interfaces, struct interface);
        if (!iface) return;
        
        ZERO_STRUCTPN(iface);