JDK-8081288 : erronous free in RegClass::~RegClass()
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 8u112,9
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2015-05-27
  • Updated: 2016-11-23
  • Resolved: 2015-10-09
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b89Fixed
Related Reports
Relates :  
Description
Freeing _classid in the destructor of RegClass is likely to be erronous. Here is the explanation provided by Krystal Mok:

"When I was looking at the call chain that leads to RegClass' constructor, get_ident() is what's passed into RegClass as classid.

The comment on get_ident_common() says:
http://hg.openjdk.java.net/jdk9/jdk9/hotspot/file/ac291bc3ece2/src/share/vm/adlc/adlparse.cpp#l4560
//------------------------------get_ident_common-------------------------------
// Looks for an identifier in the buffer, and turns it into a null terminated
// string(still inside the file buffer).  Returns a pointer to the string or
// NULL if some other token is found instead.
char *ADLParser::get_ident_common(bool do_preproc) {

So normally, the string returned should be still inside the file buffer (if no preprocessing is needed...), and shouldn't need to be free'd afterwards; but if preprocessing is needed, then yes, there's dynamically allocated memory for the string returned.
get_ident() is get_ident_common(true), so it's possible that preprocessing is needed; but from the RegClass constructor, it'd be hard to tell whether the string passed in is from the file buffer or from a dynamically allocated piece of memory."
Comments
ILW=Possible bad free, not seen in testing, none=MLH=P4
18-06-2015