Skip to content

Commit 2cf8b86

Browse files
committed
8303071: Memory leaks in libjdwp
Reviewed-by: sspitsyn
1 parent f113b04 commit 2cf8b86

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/jdk.jdwp.agent/share/native/libjdwp/transport.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ transport_startTransport(jboolean isServer, char *name, char *address,
508508
trans = info->transport;
509509

510510
if (isServer) {
511-
char *retAddress;
511+
char *retAddress = NULL;
512512
char *launchCommand;
513513
jvmtiError error;
514514
int len;
@@ -607,9 +607,13 @@ transport_startTransport(jboolean isServer, char *name, char *address,
607607
name, retAddress));
608608
}
609609
}
610+
jvmtiDeallocate(retAddress);
610611
return JDWP_ERROR(NONE);
611612

612613
handleError:
614+
if (retAddress != NULL) {
615+
jvmtiDeallocate(retAddress);
616+
}
613617
freeTransportInfo(info);
614618
} else {
615619
/*

src/jdk.jdwp.agent/share/native/libjdwp/util.c

+1
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ util_initialize(JNIEnv *env)
243243
}
244244
localSystemThreadGroup = groups[0];
245245
saveGlobalRef(env, localSystemThreadGroup, &(gdata->systemThreadGroup));
246+
jvmtiDeallocate(groups);
246247

247248
/* Get some basic Java property values we will need at some point */
248249
gdata->property_java_version

0 commit comments

Comments
 (0)