[#2238] Fix bug which caused a SIGSEGV when calling remoteAddress() or localAddress()

This commit is contained in:
Norman Maurer 2014-02-17 11:59:28 +01:00
parent 5a369e60b1
commit 8f3c09ba6b

View File

@ -132,7 +132,8 @@ jobject createInetSocketAddress(JNIEnv * env, struct sockaddr_storage addr) {
port = ntohs(s->sin6_port);
inet_ntop(AF_INET6, &s->sin6_addr, ipstr, sizeof ipstr);
}
jobject socketAddr = (*env)->NewObject(env, inetSocketAddressClass, inetSocketAddrMethodId, ipstr, port);
jstring ipString = (*env)->NewStringUTF(env, ipstr);
jobject socketAddr = (*env)->NewObject(env, inetSocketAddressClass, inetSocketAddrMethodId, ipString, port);
return socketAddr;
}