Initialize dynamicMethods before use (#9618)
Motivation: There is a goto statement above the current position of initialize dynamicMethods, and dynamicMethods is used after the goto which might cause undefined behavior. Modifications: Initialize dynamicMehtods at the top. Result: No more undefined behavior.
This commit is contained in:
parent
540798b970
commit
4a5bff2d42
@ -547,6 +547,7 @@ static jint netty_epoll_native_JNI_OnLoad(JNIEnv* env, const char* packagePrefix
|
||||
int linuxsocketOnLoadCalled = 0;
|
||||
char* nettyClassName = NULL;
|
||||
jclass nativeDatagramPacketCls = NULL;
|
||||
JNINativeMethod* dynamicMethods = NULL;
|
||||
|
||||
// We must register the statically referenced methods first!
|
||||
if (netty_unix_util_register_natives(env,
|
||||
@ -557,7 +558,7 @@ static jint netty_epoll_native_JNI_OnLoad(JNIEnv* env, const char* packagePrefix
|
||||
goto done;
|
||||
}
|
||||
// Register the methods which are not referenced by static member variables
|
||||
JNINativeMethod* dynamicMethods = createDynamicMethodsTable(packagePrefix);
|
||||
dynamicMethods = createDynamicMethodsTable(packagePrefix);
|
||||
if (dynamicMethods == NULL) {
|
||||
goto done;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user