8231124: Missing closedir call with JDK-8223490
authorcoffeys
Tue, 17 Sep 2019 16:39:56 +0000
changeset 58191 8a8e87e8a4fd
parent 58190 9adf95692a3d
child 58194 6a05019acb67
8231124: Missing closedir call with JDK-8223490 Reviewed-by: naoto
src/java.base/unix/native/libjava/TimeZone_md.c
--- a/src/java.base/unix/native/libjava/TimeZone_md.c	Tue Sep 17 08:22:14 2019 -0400
+++ b/src/java.base/unix/native/libjava/TimeZone_md.c	Tue Sep 17 16:39:56 2019 +0000
@@ -130,11 +130,6 @@
     char *tz = NULL;
     int res;
 
-    dirp = opendir(dir);
-    if (dirp == NULL) {
-        return NULL;
-    }
-
     if (strcmp(dir, ZONEINFO_DIR) == 0) {
         /* fast path for 1st iteration */
         for (unsigned int i = 0; i < sizeof (popularZones) / sizeof (popularZones[0]); i++) {
@@ -151,6 +146,11 @@
         }
     }
 
+    dirp = opendir(dir);
+    if (dirp == NULL) {
+        return NULL;
+    }
+
     while ((dp = readdir(dirp)) != NULL) {
         /*
          * Skip '.' and '..' (and possibly other .* files)