8206470: Incorrect use of os::lasterror in ClassListParser
authorcoleenp
Fri, 13 Jul 2018 13:58:17 -0400
changeset 51057 13ed0d538b89
parent 51056 3ddf41505d54
child 51058 44c355346475
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
src/hotspot/share/classfile/classListParser.cpp
--- 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() {