[#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 84b537519c
commit ea73d074f2

View File

@ -132,7 +132,8 @@ jobject createInetSocketAddress(JNIEnv * env, struct sockaddr_storage addr) {
port = ntohs(s->sin6_port); port = ntohs(s->sin6_port);
inet_ntop(AF_INET6, &s->sin6_addr, ipstr, sizeof ipstr); 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; return socketAddr;
} }