8152730: File Leak in CompileBroker::init_compiler_thread_log of compileBroker.cpp:1665.
authorrraghavan
Mon, 28 Mar 2016 20:38:05 -0700
changeset 36835 999bfb0219d6
parent 36834 fc007081f4f1
child 36836 1b58b4b10cd5
8152730: File Leak in CompileBroker::init_compiler_thread_log of compileBroker.cpp:1665. Summary: Added missing code to close file pointer. Reviewed-by: kvn
hotspot/src/share/vm/compiler/compileBroker.cpp
--- a/hotspot/src/share/vm/compiler/compileBroker.cpp	Mon Mar 28 01:08:02 2016 -0700
+++ b/hotspot/src/share/vm/compiler/compileBroker.cpp	Mon Mar 28 20:38:05 2016 -0700
@@ -1651,6 +1651,10 @@
           tty->print_cr("Opening compilation log %s", file_name);
         }
         CompileLog* log = new(ResourceObj::C_HEAP, mtCompiler) CompileLog(file_name, fp, thread_id);
+        if (log == NULL) {
+          fclose(fp);
+          return;
+        }
         thread->init_log(log);
 
         if (xtty != NULL) {