changeset 16569:f942a44fc47c

8171836: Memory leak in java.desktop/unix/native/common/awt/fontpath.c Reviewed-by: prr, arapte Contributed-by: David Carlier <devnexen@gmail.com>
author prr
date Fri, 20 Jan 2017 16:03:08 -0800
parents c17354987c3c
children 0b8c68007690
files src/java.desktop/unix/native/common/awt/fontpath.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.desktop/unix/native/common/awt/fontpath.c	Fri Jan 20 15:13:48 2017 -0800
+++ b/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;
         }