6788138: leak in Java_sun_awt_X11_XlibWrapper_getStringBytes?
authorazvegint
Mon, 07 Apr 2014 17:43:42 +0100
changeset 24166 aacae82277a0
parent 24165 fb4f67872b27
child 24167 799c5c824575
6788138: leak in Java_sun_awt_X11_XlibWrapper_getStringBytes? Reviewed-by: pchelko, serb
jdk/src/solaris/native/sun/xawt/XlibWrapper.c
--- 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;
 }