diff a/src/hotspot/os/windows/os_perf_windows.cpp b/src/hotspot/os/windows/os_perf_windows.cpp --- a/src/hotspot/os/windows/os_perf_windows.cpp +++ b/src/hotspot/os/windows/os_perf_windows.cpp @@ -223,15 +223,13 @@ assert(process_query != NULL, "invariant"); return allocate_counters(&process_query->set, nofCounters); } static void deallocate_counters(MultiCounterQueryP query) { - if (query->counters != NULL) { 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) { assert(query != NULL, "invariant"); assert(counter != NULL, "invariant"); @@ -657,18 +655,14 @@ dot_pos[0] = '\0'; return process_image_name; } 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() { assert(process_image_name == NULL, "invariant"); const char* pdh_image_name = pdh_process_image_name(); @@ -1350,20 +1344,14 @@ return true; } 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; } }