6788138: leak in Java_sun_awt_X11_XlibWrapper_getStringBytes?
Reviewed-by: pchelko, serb
--- a/jdk/src/solaris/native/sun/xawt/XlibWrapper.c Mon Apr 07 17:41:16 2014 +0100
+++ b/jdk/src/solaris/native/sun/xawt/XlibWrapper.c Mon Apr 07 17:43:42 2014 +0100
@@ -1236,10 +1236,8 @@
long length = strlen((char*)str);
jbyteArray res = (*env)->NewByteArray(env, length);
CHECK_NULL_RETURN(res, NULL);
- void * storage = malloc(length+1);
- memcpy(storage, str, length+1);
(*env)->SetByteArrayRegion(env, res, 0, length,
- (const signed char*) storage);
+ (const signed char*) str);
return res;
}