Fix a file descriptor leak in TapInterfaceDesc::interface_mtu.

This commit is contained in:
whitequark 2017-08-21 05:52:09 +00:00
parent 699f5daa3e
commit 15085bd8ba
1 changed files with 5 additions and 1 deletions

View File

@ -37,7 +37,11 @@ impl TapInterfaceDesc {
lower
};
ifreq_ioctl(lower, &mut self.ifreq, imp::SIOCGIFMTU).map(|mtu| mtu as usize)
let mtu = ifreq_ioctl(lower, &mut self.ifreq, imp::SIOCGIFMTU).map(|mtu| mtu as usize);
unsafe { libc::close(lower); }
mtu
}
fn wait(&mut self, ms: u32) -> io::Result<bool> {