[all-commits] [llvm/llvm-project] 3657e7: Add delete to fix resource leak in llc.cpp

XinWang10 via All-commits all-commits at lists.llvm.org
Tue Apr 11 23:51:01 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3657e7777f208a35981108592330d4ad7486cb14
      https://github.com/llvm/llvm-project/commit/3657e7777f208a35981108592330d4ad7486cb14
  Author: Wang, Xin10 <xin10.wang at intel.com>
  Date:   2023-04-12 (Wed, 12 Apr 2023)

  Changed paths:
    M llvm/tools/llc/llc.cpp

  Log Message:
  -----------
  Add delete to fix resource leak in llc.cpp

>From line 693 in file llc.cpp, it uses new operator to creates a ModulePass
and assigned to MMIWP. If the condition after take the true branch, it has
chance to go in to line 702 or line 709, the function will return without
cleaning the memory.
The second issue existed for the same reason, the ref TPC get the pointer
created from LLVMTM.createPassConfig, and will leak memory if goes into
line 709.
This patch uses delete in the issued branch.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D147993




More information about the All-commits mailing list