8171836: Memory leak in java.desktop/unix/native/common/awt/fontpath.c
authorprr
Fri, 20 Jan 2017 16:03:08 -0800
changeset 43318 86da43ee6364
parent 43317 cbe67e782fce
child 43319 66a889959081
8171836: Memory leak in java.desktop/unix/native/common/awt/fontpath.c Reviewed-by: prr, arapte Contributed-by: David Carlier <devnexen@gmail.com>
jdk/src/java.desktop/unix/native/common/awt/fontpath.c
--- 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;
         }