File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -669,7 +669,7 @@ static int getifaddrs(struct ifaddrs** ifap)
669669 }
670670
671671 if (!ifa ) {
672- ifa = malloc ( sizeof (struct ifaddrs ));
672+ ifa = calloc ( 1 , sizeof (struct ifaddrs ));
673673 if (!ifa ) {
674674 errno = ENOMEM ;
675675 free (pAddresses );
@@ -678,7 +678,7 @@ static int getifaddrs(struct ifaddrs** ifap)
678678 * ifap = ifa ;
679679 ifa -> ifa_next = NULL ;
680680 } else {
681- struct ifaddrs * ifanew = malloc ( sizeof (struct ifaddrs ));
681+ struct ifaddrs * ifanew = calloc ( 1 , sizeof (struct ifaddrs ));
682682 if (!ifanew ) {
683683 freeifaddrs (* ifap );
684684 free (pAddresses );
@@ -708,8 +708,7 @@ static int getifaddrs(struct ifaddrs** ifap)
708708 memcpy (ifa -> ifa_addr , unicast -> Address .lpSockaddr , unicast -> Address .iSockaddrLength );
709709
710710 /* netmask */
711- ifa -> ifa_netmask = (struct sockaddr * )malloc (sizeof (struct sockaddr_storage ));
712- memset (ifa -> ifa_netmask , 0 , sizeof (struct sockaddr_storage ));
711+ ifa -> ifa_netmask = (struct sockaddr * )calloc (1 , sizeof (struct sockaddr_storage ));
713712
714713 /* store mac address */
715714 if (adapter -> PhysicalAddressLength == 6 ) {
You can’t perform that action at this time.
0 commit comments