src/hotspot/os/windows/os_perf_windows.cpp
changeset 58084 cddef3bde924
parent 58083 9046db64ca39
child 58282 03fce7b04b42
--- a/src/hotspot/os/windows/os_perf_windows.cpp	Wed Sep 11 14:16:27 2019 +0200
+++ b/src/hotspot/os/windows/os_perf_windows.cpp	Wed Sep 11 14:16:30 2019 +0200
@@ -225,11 +225,9 @@
 }
 
 static void deallocate_counters(MultiCounterQueryP query) {
-  if (query->counters != NULL) {
-    FREE_C_HEAP_ARRAY(char, query->counters);
-    query->counters = NULL;
-    query->noOfCounters = 0;
-  }
+  FREE_C_HEAP_ARRAY(char, query->counters);
+  query->counters = NULL;
+  query->noOfCounters = 0;
 }
 
 static OSReturn add_counter(UpdateQueryP query, HCOUNTER* counter, const char* path, bool first_sample_on_init) {
@@ -659,14 +657,10 @@
 }
 
 static void deallocate_pdh_constants() {
-  if (process_image_name != NULL) {
-    FREE_C_HEAP_ARRAY(char, process_image_name);
-    process_image_name = NULL;
-  }
-  if (pdh_IDProcess_counter_fmt != NULL) {
-    FREE_C_HEAP_ARRAY(char, pdh_IDProcess_counter_fmt);
-    pdh_IDProcess_counter_fmt = NULL;
-  }
+  FREE_C_HEAP_ARRAY(char, process_image_name);
+  process_image_name = NULL;
+  FREE_C_HEAP_ARRAY(char, pdh_IDProcess_counter_fmt);
+  pdh_IDProcess_counter_fmt = NULL;
 }
 
 static int allocate_pdh_constants() {
@@ -1352,16 +1346,10 @@
 
 CPUInformationInterface::~CPUInformationInterface() {
   if (_cpu_info != NULL) {
-    const char* cpu_name = _cpu_info->cpu_name();
-    if (cpu_name != NULL) {
-      FREE_C_HEAP_ARRAY(char, cpu_name);
-      _cpu_info->set_cpu_name(NULL);
-    }
-    const char* cpu_desc = _cpu_info->cpu_description();
-    if (cpu_desc != NULL) {
-      FREE_C_HEAP_ARRAY(char, cpu_desc);
-      _cpu_info->set_cpu_description(NULL);
-    }
+    FREE_C_HEAP_ARRAY(char, _cpu_info->cpu_name());
+    _cpu_info->set_cpu_name(NULL);
+    FREE_C_HEAP_ARRAY(char, _cpu_info->cpu_description());
+    _cpu_info->set_cpu_description(NULL);
     delete _cpu_info;
     _cpu_info = NULL;
   }