diff src/share/vm/adlc/output_h.cpp @ 9078:705ef39fcaa9

8006016: Memory leak at hotspot/src/share/vm/adlc/output_c.cpp Reviewed-by: kvn, roland Contributed-by: niclas.adlertz@oracle.com
author neliasso
date Fri, 05 Apr 2013 11:09:43 +0200
parents d336b3173277
children c9ccd7b85f20 7373e44fa207
line wrap: on
line diff
--- a/src/share/vm/adlc/output_h.cpp	Thu Apr 04 21:15:43 2013 -0700
+++ b/src/share/vm/adlc/output_h.cpp	Fri Apr 05 11:09:43 2013 +0200
@@ -2069,9 +2069,21 @@
   void closing()     { fprintf(_cpp, "  _LAST_MACH_OPER\n");
                        OutputMap::closing();
   }
-  void map(OpClassForm &opc)  { fprintf(_cpp, "  %s", _AD.machOperEnum(opc._ident) ); }
-  void map(OperandForm &oper) { fprintf(_cpp, "  %s", _AD.machOperEnum(oper._ident) ); }
-  void map(char        *name) { fprintf(_cpp, "  %s", _AD.machOperEnum(name)); }
+  void map(OpClassForm &opc)  {
+    const char* opc_ident_to_upper = _AD.machOperEnum(opc._ident);
+    fprintf(_cpp, "  %s", opc_ident_to_upper);
+    delete[] opc_ident_to_upper;
+  }
+  void map(OperandForm &oper) {
+    const char* oper_ident_to_upper = _AD.machOperEnum(oper._ident);
+    fprintf(_cpp, "  %s", oper_ident_to_upper);
+    delete[] oper_ident_to_upper;
+  }
+  void map(char *name) {
+    const char* name_to_upper = _AD.machOperEnum(name);
+    fprintf(_cpp, "  %s", name_to_upper);
+    delete[] name_to_upper;
+  }
 
   bool do_instructions()      { return false; }
   void map(InstructForm &inst){ assert( false, "ShouldNotCallThis()"); }