changeset 9846:de1b74b33be2

6788138: leak in Java_sun_awt_X11_XlibWrapper_getStringBytes? Reviewed-by: pchelko, serb
author azvegint
date Mon, 07 Apr 2014 17:43:42 +0100
parents 82ff53bbc895
children c2fab0bedaac
files src/solaris/native/sun/xawt/XlibWrapper.c
diffstat 1 files changed, 1 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/solaris/native/sun/xawt/XlibWrapper.c	Mon Apr 07 17:41:16 2014 +0100
+++ b/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;
 }