summaryrefslogtreecommitdiffstats
path: root/Utilities/cmlibuv/src/unix/aix-common.c
diff options
context:
space:
mode:
Diffstat (limited to 'Utilities/cmlibuv/src/unix/aix-common.c')
-rw-r--r--Utilities/cmlibuv/src/unix/aix-common.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/Utilities/cmlibuv/src/unix/aix-common.c b/Utilities/cmlibuv/src/unix/aix-common.c
index 9c11c5d..e9697e9 100644
--- a/Utilities/cmlibuv/src/unix/aix-common.c
+++ b/Utilities/cmlibuv/src/unix/aix-common.c
@@ -166,8 +166,7 @@ void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) {
}
-int uv_interface_addresses(uv_interface_address_t** addresses,
- int* count) {
+int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
uv_interface_address_t* address;
int sockfd, inet6, size = 1;
struct ifconf ifc;
@@ -175,6 +174,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses,
struct sockaddr_dl* sa_addr;
*count = 0;
+ *addresses = NULL;
if (0 > (sockfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP))) {
return UV__ERR(errno);
@@ -217,6 +217,11 @@ int uv_interface_addresses(uv_interface_address_t** addresses,
(*count)++;
}
+ if (*count == 0) {
+ uv__close(sockfd);
+ return 0;
+ }
+
/* Alloc the return interface structs */
*addresses = uv__malloc(*count * sizeof(uv_interface_address_t));
if (!(*addresses)) {
@@ -290,3 +295,4 @@ void uv_free_interface_addresses(uv_interface_address_t* addresses,
uv__free(addresses);
}
+