summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-02-16 15:24:13 -0500
committerNick Mathewson <nickm@torproject.org>2015-02-16 15:24:13 -0500
commit2af7bc5b46b23717f30d412bd630e56edde77a3b (patch)
treed5112d06ade96e33132161c717aad3886ed26090 /src
parent3bcdb26267502e0d1de5d01854c8a2cf29a5e5f4 (diff)
downloadtor-2af7bc5b46b23717f30d412bd630e56edde77a3b.tar.gz
tor-2af7bc5b46b23717f30d412bd630e56edde77a3b.zip
Fix a trivial double-close in address.c. CID 1268071
Diffstat (limited to 'src')
-rw-r--r--src/common/address.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/common/address.c b/src/common/address.c
index dbb92759d4..d8202e17a5 100644
--- a/src/common/address.c
+++ b/src/common/address.c
@@ -1448,7 +1448,6 @@ get_interface_addresses_ioctl(int severity)
if (ioctl(fd, SIOCGIFCONF, &ifc) < 0) {
tor_log(severity, LD_NET, "ioctl failed: %s", strerror(errno));
- close(fd);
goto done;
}
/* 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);
done:
- close(fd);
+ if (fd >= 0)
+ close(fd);
tor_free(ifc.ifc_buf);
return result;
}