summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp b/luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp
index 8b8fe35..29fd217 100644
--- a/luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp
+++ b/luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp
@@ -534,6 +534,7 @@ static jbyteArray osNetworkSystem_ipStringToByteArray(JNIEnv *env, jclass clazz,
jstring javaString) {
if (javaString == NULL) {
throwNullPointerException(env);
+ return NULL;
}
char ipString[INET6_ADDRSTRLEN];
@@ -548,10 +549,12 @@ static jbyteArray osNetworkSystem_ipStringToByteArray(JNIEnv *env, jclass clazz,
}
jbyteArray result = NULL;
- sockaddr_in sin;
- addrinfo hints, *res;
+ addrinfo hints;
memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_NUMERICHOST;
+
+ sockaddr_in sin;
+ addrinfo *res = NULL;
int ret = getaddrinfo(ipString, NULL, &hints, &res);
if (ret == 0 && res) {
// Convert mapped addresses to IPv4 addresses if necessary.