gdhcp: Possible file descriptor leak
authorJukka Rissanen <jukka.rissanen@linux.intel.com>
Fri, 28 Oct 2011 09:28:59 +0000 (12:28 +0300)
committerSamuel Ortiz <sameo@linux.intel.com>
Fri, 28 Oct 2011 21:41:30 +0000 (23:41 +0200)
gdhcp/common.c

index 43f6735..0a2b51b 100644 (file)
@@ -343,11 +343,11 @@ int dhcp_send_raw_packet(struct dhcp_packet *dhcp_pkt,
         */
        n = sendto(fd, &packet, IP_UPD_DHCP_SIZE, 0,
                        (struct sockaddr *) &dest, sizeof(dest));
+       close(fd);
+
        if (n < 0)
                return -errno;
 
-       close(fd);
-
        return n;
 }