Fix a trivial double-close in address.c. CID 1268071

This commit is contained in:
Nick Mathewson 2015-02-16 15:24:13 -05:00
parent 3bcdb26267
commit 2af7bc5b46

View File

@ -1448,7 +1448,6 @@ get_interface_addresses_ioctl(int severity)
if (ioctl(fd, SIOCGIFCONF, &ifc) < 0) { if (ioctl(fd, SIOCGIFCONF, &ifc) < 0) {
tor_log(severity, LD_NET, "ioctl failed: %s", strerror(errno)); tor_log(severity, LD_NET, "ioctl failed: %s", strerror(errno));
close(fd);
goto done; goto done;
} }
/* Ensure we have least IFREQ_SIZE bytes unused at the end. Otherwise, we /* Ensure we have least IFREQ_SIZE bytes unused at the end. Otherwise, we
@ -1457,7 +1456,8 @@ get_interface_addresses_ioctl(int severity)
result = ifreq_to_smartlist(ifc.ifc_buf, ifc.ifc_len); result = ifreq_to_smartlist(ifc.ifc_buf, ifc.ifc_len);
done: done:
close(fd); if (fd >= 0)
close(fd);
tor_free(ifc.ifc_buf); tor_free(ifc.ifc_buf);
return result; return result;
} }