Unverified Commit 1322cb60 by Donghwa Jeong Committed by Christian Brauner

network: fix socket handle leak

parent 1bd237a6
...@@ -1946,7 +1946,12 @@ int setup_private_host_hw_addr(char *veth1) ...@@ -1946,7 +1946,12 @@ int setup_private_host_hw_addr(char *veth1)
if (sockfd < 0) if (sockfd < 0)
return -errno; return -errno;
snprintf((char *)ifr.ifr_name, IFNAMSIZ, "%s", veth1); err = snprintf((char *)ifr.ifr_name, IFNAMSIZ, "%s", veth1);
if (err < 0 || (size_t)err >= IFNAMSIZ) {
close(sockfd);
return -E2BIG;
}
err = ioctl(sockfd, SIOCGIFHWADDR, &ifr); err = ioctl(sockfd, SIOCGIFHWADDR, &ifr);
if (err < 0) { if (err < 0) {
close(sockfd); close(sockfd);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment