# HG changeset patch # User rwestberg # Date 1533560216 -7200 # Node ID d2c720caa480271dd29dd9b42adbe97911d7478a # Parent 945ba9278a272a5477ffb1b3ea1b04174fed8036 8208676: Missing NULL check and resource leak in NetworkPerformanceInterface::NetworkPerformance::network_utilization Reviewed-by: mgronlun, rehn diff -r 945ba9278a27 -r d2c720caa480 src/hotspot/os/linux/os_perf_linux.cpp --- a/src/hotspot/os/linux/os_perf_linux.cpp Tue Aug 07 00:06:52 2018 -0700 +++ b/src/hotspot/os/linux/os_perf_linux.cpp Mon Aug 06 14:56:56 2018 +0200 @@ -1107,7 +1107,7 @@ NetworkInterface* ret = NULL; for (cur_address = addresses; cur_address != NULL; cur_address = cur_address->ifa_next) { - if (cur_address->ifa_addr->sa_family != AF_PACKET) { + if ((cur_address->ifa_addr == NULL) || (cur_address->ifa_addr->sa_family != AF_PACKET)) { continue; } @@ -1118,6 +1118,7 @@ ret = cur; } + freeifaddrs(addresses); *network_interfaces = ret; return OS_OK; diff -r 945ba9278a27 -r d2c720caa480 src/hotspot/os/solaris/os_perf_solaris.cpp --- a/src/hotspot/os/solaris/os_perf_solaris.cpp Tue Aug 07 00:06:52 2018 -0700 +++ b/src/hotspot/os/solaris/os_perf_solaris.cpp Mon Aug 06 14:56:56 2018 +0200 @@ -816,6 +816,7 @@ } } + kstat_close(ctl); *network_interfaces = ret; return OS_OK;