jdk/src/java.desktop/windows/native/libfontmanager/fontpath.c
changeset 39874 bf85c2b8f0e0
parent 39864 8b3ec2abf2b1
child 40423 6b56a2890514
--- a/jdk/src/java.desktop/windows/native/libfontmanager/fontpath.c	Mon Jul 18 15:43:30 2016 -0500
+++ b/jdk/src/java.desktop/windows/native/libfontmanager/fontpath.c	Mon Jul 25 15:09:23 2016 -0700
@@ -305,8 +305,8 @@
     familyLC = (*env)->CallObjectMethod(env, fmi->family,
                                         fmi->toLowerCaseMID, fmi->locale);
     /* Delete the created reference after its usage */
-    DeleteLocalReference(env, fmi->family);
     if ((*env)->ExceptionCheck(env)) {
+        DeleteLocalReference(env, fmi->family);
         return 0;
     }
 
@@ -317,10 +317,12 @@
                                                    familyLC);
     if ((*env)->ExceptionCheck(env)) {
         /* Delete the created references before return */
+        DeleteLocalReference(env, fmi->family);
         DeleteLocalReference(env, familyLC);
         return 0;
     } else if (mapHasKey) {
         /* Delete the created references before return */
+        DeleteLocalReference(env, fmi->family);
         DeleteLocalReference(env, familyLC);
         return 1;
     }
@@ -329,6 +331,7 @@
                                   fmi->arrayListClass, fmi->arrayListCtr, 4);
     if (fmi->list == NULL) {
         /* Delete the created references before return */
+        DeleteLocalReference(env, fmi->family);
         DeleteLocalReference(env, familyLC);
         return 0;
     }
@@ -339,6 +342,7 @@
     DeleteLocalReference(env, familyLC);
     if ((*env)->ExceptionCheck(env)) {
         /* Delete the created reference before return */
+        DeleteLocalReference(env, fmi->family);
         DeleteLocalReference(env, fmi->list);
         return 0;
     }
@@ -351,6 +355,7 @@
                         lParam, 0L);
 
     /* Delete the created reference after its usage in the enum function */
+    DeleteLocalReference(env, fmi->family);
     DeleteLocalReference(env, fmi->list);
     return 1;
 }