changeset 4660:0b7f78069732

8008255: jvmtiExport.cpp::post_to_env() does not check malloc() return Reviewed-by: coleenp, dholmes, sla
author rbackman
date Wed, 08 May 2013 11:21:56 +0200
parents c272092594bd
children 735c995bf1a1 1fcfc045b229
files src/share/vm/prims/jvmtiExport.cpp
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/prims/jvmtiExport.cpp	Wed May 08 21:06:46 2013 -0400
+++ b/src/share/vm/prims/jvmtiExport.cpp	Wed May 08 11:21:56 2013 +0200
@@ -619,6 +619,9 @@
         // data has been changed by the new retransformable agent
         // and it hasn't already been cached, cache it
         *_cached_data_ptr = (unsigned char *)os::malloc(_curr_len, mtInternal);
+        if (*_cached_data_ptr == NULL) {
+          vm_exit_out_of_memory(_curr_len, OOM_MALLOC_ERROR, "unable to allocate cached copy of original class bytes");
+        }
         memcpy(*_cached_data_ptr, _curr_data, _curr_len);
         *_cached_length_ptr = _curr_len;
       }