netdev: Fix file descriptor leak.
authorBen Pfaff <blp@nicira.com>
Fri, 9 Jan 2009 01:10:34 +0000 (17:10 -0800)
committerBen Pfaff <blp@nicira.com>
Tue, 13 Jan 2009 01:17:40 +0000 (17:17 -0800)
This could be important since it leaks a file descriptor on every
netdev_open(), but only if an IPv6 address is configured on the network
device (which is rare and indicates an error condition for OpenFlow).

Found by Chris Eagle via Fortify.

lib/netdev.c

index 08afc39..e83c647 100644 (file)
@@ -145,6 +145,7 @@ get_ipv6_address(const char *name, struct in6_addr *in6)
                    ifname) == 17
             && !strcmp(name, ifname))
         {
+            fclose(file);
             return;
         }
     }