8146317: Memory leak in wcstombsdmp
Reviewed-by: serb, psadhukhan, ssadetsky
Contributed-by: Alex Henrie <alexhenrie24@gmail.com>
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_InputMethod.c Mon Jan 18 14:37:25 2016 +0530
+++ b/jdk/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;
}