8206470: Incorrect use of os::lasterror in ClassListParser
Summary: The change is for future-proof the code in case errno gets overwritten inside the allocation logic.
Reviewed-by: dholmes
Contributed-by: patricio.chilano.mateo@oracle.com
--- a/src/hotspot/share/classfile/classListParser.cpp Sun Jun 03 23:33:00 2018 -0700
+++ b/src/hotspot/share/classfile/classListParser.cpp Fri Jul 13 13:58:17 2018 -0400
@@ -48,14 +48,13 @@
_instance = this;
_classlist_file = file;
_file = fopen(file, "r");
- _line_no = 0;
- _interfaces = new (ResourceObj::C_HEAP, mtClass) GrowableArray<int>(10, true);
-
if (_file == NULL) {
char errmsg[JVM_MAXPATHLEN];
os::lasterror(errmsg, JVM_MAXPATHLEN);
vm_exit_during_initialization("Loading classlist failed", errmsg);
}
+ _line_no = 0;
+ _interfaces = new (ResourceObj::C_HEAP, mtClass) GrowableArray<int>(10, true);
}
ClassListParser::~ClassListParser() {