changeset 13643:30f9a47b806c

8146317: Memory leak in wcstombsdmp Reviewed-by: serb, psadhukhan, ssadetsky Contributed-by: Alex Henrie <alexhenrie24@gmail.com>
author serb
date Mon, 18 Jan 2016 21:19:36 +0300
parents 0be89ec21b1b
children 43e514b823cf
files src/java.desktop/unix/native/libawt_xawt/awt/awt_InputMethod.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.desktop/unix/native/libawt_xawt/awt/awt_InputMethod.c	Mon Jan 18 14:37:25 2016 +0530
+++ b/src/java.desktop/unix/native/libawt_xawt/awt/awt_InputMethod.c	Mon Jan 18 21:19:36 2016 +0300
@@ -221,8 +221,10 @@
     }
 
     /* TODO: check return values... Handle invalid characters properly...  */
-    if (wcstombs(mbs, wcs, n) == (size_t)-1)
+    if (wcstombs(mbs, wcs, n) == (size_t)-1) {
+        free(mbs);
         return NULL;
+    }
 
     return mbs;
 }