changeset 13750:f9822409c531

8231124: Missing closedir call with JDK-8223490 Reviewed-by: phh, andrew
author alvdavi
date Tue, 17 Dec 2019 04:41:12 +0000
parents d2ccbd9ff51b
children a41e03cafc13
files src/solaris/native/java/util/TimeZone_md.c
diffstat 1 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/solaris/native/java/util/TimeZone_md.c	Fri Nov 22 10:06:55 2019 +0100
+++ b/src/solaris/native/java/util/TimeZone_md.c	Tue Dec 17 04:41:12 2019 +0000
@@ -123,17 +123,6 @@
     char *pathname = NULL;
     char *tz = NULL;
 
-    dirp = opendir(dir);
-    if (dirp == NULL) {
-        return NULL;
-    }
-
-    entry = (struct dirent64 *) malloc((size_t) pathconf(dir, _PC_NAME_MAX));
-    if (entry == NULL) {
-        (void) closedir(dirp);
-        return NULL;
-    }
-
     if (strcmp(dir, ZONEINFO_DIR) == 0) {
         /* fast path for 1st iteration */
         unsigned int i;
@@ -151,6 +140,17 @@
         }
     }
 
+    dirp = opendir(dir);
+    if (dirp == NULL) {
+        return NULL;
+    }
+
+    entry = (struct dirent64 *) malloc((size_t) pathconf(dir, _PC_NAME_MAX));
+    if (entry == NULL) {
+        (void) closedir(dirp);
+        return NULL;
+    }
+
     while (readdir64_r(dirp, entry, &dp) == 0 && dp != NULL) {
         /*
          * Skip '.' and '..' (and possibly other .* files)