RFR: 8231124: Missing closedir call with JDK-8223490

Seán Coffey sean.coffey at oracle.com
Tue Sep 17 16:27:33 UTC 2019


A minor issue that was introduced via my recent JDK-8223490 fix. One 
which I noticed while backporting the edits..

https://bugs.openjdk.java.net/browse/JDK-8231124

proposed patch:
diff --git a/src/java.base/unix/native/libjava/TimeZone_md.c 
b/src/java.base/unix/native/libjava/TimeZone_md.c
--- a/src/java.base/unix/native/libjava/TimeZone_md.c
+++ b/src/java.base/unix/native/libjava/TimeZone_md.c
@@ -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)


==

regards,
Sean.




More information about the core-libs-dev mailing list