8171836: Memory leak in java.desktop/unix/native/common/awt/fontpath.c
Reviewed-by: prr, arapte
Contributed-by: David Carlier <devnexen@gmail.com>
--- a/jdk/src/java.desktop/unix/native/common/awt/fontpath.c Fri Jan 20 15:13:48 2017 -0800
+++ b/jdk/src/java.desktop/unix/native/common/awt/fontpath.c Fri Jan 20 16:03:08 2017 -0800
@@ -289,6 +289,12 @@
onePath = SAFE_SIZE_ARRAY_ALLOC(malloc, strlen (fDirP->name[index]) + 2, sizeof( char ) );
if (onePath == NULL) {
free ( ( void *) appendDirList );
+
+ for ( index = origIndex; index < nPaths; index++ ) {
+ free( newFontPath[index] );
+ }
+
+ free( ( void *) newFontPath);
XFreeFontPath ( origFontPath );
return;
}