jni.cc (_Jv_JNI_AttachCurrentThread): Return error if malloc fails.
* jni.cc (_Jv_JNI_AttachCurrentThread): Return error if malloc fails. From-SVN: r31986
This commit is contained in:
parent
fa545500ad
commit
2d759f7165
@ -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.
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user