From ea6b19069d3522417157330331bbf73b47ab6f14 Mon Sep 17 00:00:00 2001 From: alvdavi Date: Tue, 17 Dec 2019 04:41:12 +0000 Subject: [PATCH] 8231124: Missing closedir call with JDK-8223490 Reviewed-by: phh, andrew --- src/solaris/native/java/util/TimeZone_md.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/solaris/native/java/util/TimeZone_md.c b/src/solaris/native/java/util/TimeZone_md.c index a1f1dc37e..7ec893b6b 100644 --- a/src/solaris/native/java/util/TimeZone_md.c +++ b/src/solaris/native/java/util/TimeZone_md.c @@ -123,17 +123,6 @@ findZoneinfoFile(char *buf, size_t size, const char *dir) 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 @@ findZoneinfoFile(char *buf, size_t size, const char *dir) } } + 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) -- GitLab