src/hotspot/os/windows/os_perf_windows.cpp
changeset 53882 ca682d9d8db5
parent 50879 d90c3cbf13df
child 58083 9046db64ca39
child 58678 9cf78a70fa4f
--- a/src/hotspot/os/windows/os_perf_windows.cpp	Thu Feb 21 15:17:42 2019 -0800
+++ b/src/hotspot/os/windows/os_perf_windows.cpp	Thu Feb 21 16:56:06 2019 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1253,14 +1253,7 @@
 
 char* SystemProcessInterface::SystemProcesses::ProcessIterator::allocate_string(const char* str) const {
   if (str != NULL) {
-    size_t len = strlen(str);
-    char* tmp = NEW_C_HEAP_ARRAY(char, len+1, mtInternal);
-    if (NULL == tmp) {
-      return NULL;
-    }
-    strncpy(tmp, str, len);
-    tmp[len] = '\0';
-    return tmp;
+    return os::strdup_check_oom(str, mtInternal);
   }
   return NULL;
 }