aboutsummaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
authorKeith Seitz <keiths@redhat.com>2006-09-21 00:09:48 +0000
committerKeith Seitz <keiths@redhat.com>2006-09-21 00:09:48 +0000
commit09bd9f94bb0da8374fed0bef2bd602d40b2fa543 (patch)
tree0f64812291b74ddd863e241f1bdd52bd58537e3b /libjava
parent42b8ff9841be85eb2f80de5d172eceaffac985f6 (diff)
* jvmti.cc (_Jv_JVMTI_CreateRawMonitor): Use _Jv_MallocUnchked
and return JVMTI_ERROR_OUT_OF_MEMORY if necessary. (_Jv_JVMTI_GetClassMethods): Likewise. (_Jv_JVMTI_GetClassLoaderClasses): Likewise. (_Jv_JVMTI_GetJNIFunctionTable): Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@117098 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog9
-rw-r--r--libjava/jvmti.cc24
2 files changed, 28 insertions, 5 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index e22d26aa8bd..dce88d57aa0 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,5 +1,14 @@
2006-09-20 Keith Seitz <keiths@redhat.com>
+ * jvmti.cc (_Jv_JVMTI_CreateRawMonitor): Use _Jv_MallocUnchked
+ and return JVMTI_ERROR_OUT_OF_MEMORY if necessary.
+ (_Jv_JVMTI_GetClassMethods): Likewise.
+ (_Jv_JVMTI_GetClassLoaderClasses): Likewise.
+ (_Jv_JVMTI_GetJNIFunctionTable): Likewise.
+ (_Jv_JVMTI_GetSystemProperty): Likewise.
+
+2006-09-20 Keith Seitz <keiths@redhat.com>
+
* jvmti.cc (_Jv_JVMTI_GetErrorName): New function.
(_Jv_JVMTI_Interface): Define GetErrorName member.
* testsuite/libjava.jvmti/geterrorname.java: New file.
diff --git a/libjava/jvmti.cc b/libjava/jvmti.cc
index b18ac68dc78..22b76fb25ff 100644
--- a/libjava/jvmti.cc
+++ b/libjava/jvmti.cc
@@ -156,7 +156,9 @@ _Jv_JVMTI_CreateRawMonitor (MAYBE_UNUSED jvmtiEnv *env, const char *name,
REQUIRE_PHASE (env, JVMTI_PHASE_ONLOAD | JVMTI_PHASE_LIVE);
NULL_CHECK (name);
NULL_CHECK (result);
- *result = (jrawMonitorID) _Jv_Malloc (sizeof (_Jv_rawMonitorID));
+ *result = (jrawMonitorID) _Jv_MallocUnchecked (sizeof (_Jv_rawMonitorID));
+ if (*result == NULL)
+ return JVMTI_ERROR_OUT_OF_MEMORY;
_Jv_MutexInit (&(*result)->mutex);
_Jv_CondInit (&(*result)->condition);
return JVMTI_ERROR_NONE;
@@ -285,7 +287,11 @@ _Jv_JVMTI_GetClassMethods (MAYBE_UNUSED jvmtiEnv *env, jclass klass,
NULL_CHECK (methods_ptr);
*count_ptr = JvNumMethods(klass);
- *methods_ptr = (jmethodID *) _Jv_Malloc (*count_ptr * sizeof (jmethodID));
+ *methods_ptr
+ = (jmethodID *) _Jv_MallocUnchecked (*count_ptr * sizeof (jmethodID));
+ if (*methods_ptr == NULL)
+ return JVMTI_ERROR_OUT_OF_MEMORY;
+
jmethodID start = JvGetFirstMethod (klass);
for (jint i = 0; i < *count_ptr; ++i)
// FIXME: correct?
@@ -437,7 +443,11 @@ _Jv_JVMTI_GetClassLoaderClasses (MAYBE_UNUSED jvmtiEnv *env,
jobjectArray array = values->toArray();
*count_ptr = array->length;
jobject *elts = elements (array);
- jclass *result = (jclass *) _Jv_Malloc (*count_ptr * sizeof (jclass));
+ jclass *result
+ = (jclass *) _Jv_MallocUnchecked (*count_ptr * sizeof (jclass));
+ if (result == NULL)
+ return JVMTI_ERROR_OUT_OF_MEMORY;
+
// FIXME: JNI references...
memcpy (result, elts, *count_ptr * sizeof (jclass));
@@ -471,7 +481,9 @@ _Jv_JVMTI_GetJNIFunctionTable (MAYBE_UNUSED jvmtiEnv *env,
REQUIRE_PHASE (env, JVMTI_PHASE_START | JVMTI_PHASE_LIVE);
NULL_CHECK (function_table);
*function_table
- = (jniNativeInterface *) _Jv_Malloc (sizeof (jniNativeInterface));
+ = (jniNativeInterface *) _Jv_MallocUnchecked (sizeof (jniNativeInterface));
+ if (*function_table == NULL)
+ return JVMTI_ERROR_OUT_OF_MEMORY;
memcpy (*function_table, &_Jv_JNIFunctions, sizeof (jniNativeInterface));
return JVMTI_ERROR_NONE;
}
@@ -525,7 +537,9 @@ _Jv_JVMTI_GetSystemProperty (MAYBE_UNUSED jvmtiEnv *env, const char *property,
return JVMTI_ERROR_NOT_AVAILABLE;
int len = JvGetStringUTFLength (result_str);
- *result = (char *) _Jv_Malloc (len + 1);
+ *result = (char *) _Jv_MallocUnchecked (len + 1);
+ if (*result == NULL)
+ return JVMTI_ERROR_OUT_OF_MEMORY;
JvGetStringUTFRegion (result_str, 0, result_str->length(), *result);
(*result)[len] = '\0';