mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-27 22:03:31 +01:00
Fix a trivial double-close in address.c. CID 1268071
This commit is contained in:
parent
3bcdb26267
commit
2af7bc5b46
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user