mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8280414: Memory leak in DefaultProxySelector
Reviewed-by: dfuchs
This commit is contained in:
parent
496baada10
commit
fe77250fa4
1 changed files with 8 additions and 10 deletions
|
@ -104,7 +104,6 @@ static int createProxyList(LPWSTR win_proxy, const WCHAR *pproto, list_item **he
|
|||
int nr_elems = 0;
|
||||
wchar_t *context = NULL;
|
||||
wchar_t *current_proxy = NULL;
|
||||
BOOL error = FALSE;
|
||||
|
||||
/*
|
||||
* The proxy server list contains one or more of the following strings
|
||||
|
@ -116,7 +115,6 @@ static int createProxyList(LPWSTR win_proxy, const WCHAR *pproto, list_item **he
|
|||
LPWSTR pport;
|
||||
LPWSTR phost;
|
||||
int portVal = 0;
|
||||
wchar_t *next_proxy = NULL;
|
||||
list_item *proxy = NULL;
|
||||
wchar_t* pos = NULL;
|
||||
|
||||
|
@ -292,7 +290,6 @@ Java_sun_net_spi_DefaultProxySelector_getSystemProxies(JNIEnv *env,
|
|||
}
|
||||
|
||||
if (win_proxy != NULL) {
|
||||
wchar_t *context = NULL;
|
||||
int defport = 0;
|
||||
int nr_elems = 0;
|
||||
|
||||
|
@ -315,27 +312,28 @@ Java_sun_net_spi_DefaultProxySelector_getSystemProxies(JNIEnv *env,
|
|||
nr_elems = createProxyList(win_proxy, lpProto, &head);
|
||||
if (nr_elems != 0 && head != NULL) {
|
||||
int index = 0;
|
||||
list_item *current = head;
|
||||
proxy_array = (*env)->NewObjectArray(env, nr_elems, proxy_class, NULL);
|
||||
if (proxy_array == NULL || (*env)->ExceptionCheck(env)) {
|
||||
goto noproxy;
|
||||
}
|
||||
while (head != NULL && index < nr_elems) {
|
||||
while (current != NULL && index < nr_elems) {
|
||||
jstring jhost;
|
||||
jobject isa;
|
||||
jobject proxy;
|
||||
|
||||
if (head->host != NULL && proxy_array != NULL) {
|
||||
if (current->host != NULL && proxy_array != NULL) {
|
||||
/* Let's create the appropriate Proxy object then. */
|
||||
if (head->port == 0) {
|
||||
head->port = defport;
|
||||
if (current->port == 0) {
|
||||
current->port = defport;
|
||||
}
|
||||
jhost = (*env)->NewString(env, head->host, (jsize)wcslen(head->host));
|
||||
jhost = (*env)->NewString(env, current->host, (jsize)wcslen(current->host));
|
||||
if (jhost == NULL || (*env)->ExceptionCheck(env)) {
|
||||
proxy_array = NULL;
|
||||
}
|
||||
isa = (*env)->CallStaticObjectMethod(env, isaddr_class,
|
||||
isaddr_createUnresolvedID, jhost,
|
||||
head->port);
|
||||
current->port);
|
||||
if (isa == NULL || (*env)->ExceptionCheck(env)) {
|
||||
proxy_array = NULL;
|
||||
}
|
||||
|
@ -349,7 +347,7 @@ Java_sun_net_spi_DefaultProxySelector_getSystemProxies(JNIEnv *env,
|
|||
}
|
||||
index++;
|
||||
}
|
||||
head = head->next;
|
||||
current = current->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue