network: fix socket handle leak

Signed-off-by: Donghwa Jeong <dh48.jeong@samsung.com>
This commit is contained in:
Donghwa Jeong 2018-05-28 13:42:45 +09:00
parent f1a571d669
commit 87c6e5db2a

4
src/lxc/network.c Normal file → Executable file
View File

@ -2027,8 +2027,10 @@ int setup_private_host_hw_addr(char *veth1)
return -errno; return -errno;
err = snprintf((char *)ifr.ifr_name, IFNAMSIZ, "%s", veth1); err = snprintf((char *)ifr.ifr_name, IFNAMSIZ, "%s", veth1);
if (err < 0 || (size_t)err >= IFNAMSIZ) if (err < 0 || (size_t)err >= IFNAMSIZ) {
close(sockfd);
return -E2BIG; return -E2BIG;
}
err = ioctl(sockfd, SIOCGIFHWADDR, &ifr); err = ioctl(sockfd, SIOCGIFHWADDR, &ifr);
if (err < 0) { if (err < 0) {