提交 ea6b1906 编写于 作者: A alvdavi

8231124: Missing closedir call with JDK-8223490

Reviewed-by: phh, andrew
上级 b5de5bb1
...@@ -123,17 +123,6 @@ findZoneinfoFile(char *buf, size_t size, const char *dir) ...@@ -123,17 +123,6 @@ findZoneinfoFile(char *buf, size_t size, const char *dir)
char *pathname = NULL; char *pathname = NULL;
char *tz = 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) { if (strcmp(dir, ZONEINFO_DIR) == 0) {
/* fast path for 1st iteration */ /* fast path for 1st iteration */
unsigned int i; unsigned int i;
...@@ -151,6 +140,17 @@ findZoneinfoFile(char *buf, size_t size, const char *dir) ...@@ -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) { while (readdir64_r(dirp, entry, &dp) == 0 && dp != NULL) {
/* /*
* Skip '.' and '..' (and possibly other .* files) * Skip '.' and '..' (and possibly other .* files)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册