diff options
author | Tom Tromey <tromey@cygnus.com> | 2000-02-15 20:39:36 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2000-02-15 20:39:36 +0000 |
commit | 2d759f7165b869d20ce6e1162aa6e692290ece94 (patch) | |
tree | b9dde6a01520c0781831c2129ba55749d8fb4d33 /libjava | |
parent | fa545500adf713269fd38f26d28523cefc8c0c7b (diff) | |
download | gcc-2d759f7165b869d20ce6e1162aa6e692290ece94.zip gcc-2d759f7165b869d20ce6e1162aa6e692290ece94.tar.gz gcc-2d759f7165b869d20ce6e1162aa6e692290ece94.tar.bz2 |
jni.cc (_Jv_JNI_AttachCurrentThread): Return error if malloc fails.
* jni.cc (_Jv_JNI_AttachCurrentThread): Return error if malloc
fails.
From-SVN: r31986
Diffstat (limited to 'libjava')
-rw-r--r-- | libjava/ChangeLog | 5 | ||||
-rw-r--r-- | libjava/jni.cc | 9 |
2 files changed, 12 insertions, 2 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index eaec78d..49142ac 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,8 @@ +2000-02-15 Tom Tromey <tromey@cygnus.com> + + * jni.cc (_Jv_JNI_AttachCurrentThread): Return error if malloc + fails. + 2000-02-15 Bryce McKinlay <bryce@albatross.co.nz> * NEWS: Updated. diff --git a/libjava/jni.cc b/libjava/jni.cc index 6beb6f7..48c63b0 100644 --- a/libjava/jni.cc +++ b/libjava/jni.cc @@ -1415,16 +1415,21 @@ _Jv_JNI_AttachCurrentThread (JavaVM *, jstring name, void **penv, void *args) if (_Jv_ThreadCurrent () != NULL) return 0; - // FIXME: NULL return? JNIEnv *env = (JNIEnv *) _Jv_MallocUnchecked (sizeof (JNIEnv)); + if (env == NULL) + return JNI_ERR; env->p = &_Jv_JNIFunctions; env->ex = NULL; env->klass = NULL; - // FIXME: NULL return? env->locals = (_Jv_JNI_LocalFrame *) _Jv_MallocUnchecked (sizeof (_Jv_JNI_LocalFrame) + (FRAME_SIZE * sizeof (jobject))); + if (env->locals == NULL) + { + _Jv_Free (env); + return JNI_ERR; + } *penv = reinterpret_cast<void *> (env); java::lang::Thread *t = new gnu::gcj::jni::NativeThread (group, name); |