[all-commits] [llvm/llvm-project] 509f5c: [MC] Fix memory leak when allocating MCInst with b...

Hendrik Greving via All-commits all-commits at lists.llvm.org
Mon Aug 3 16:08:45 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 509f5c4ec2dbae99713ac6292c3a6bd7ba50027c
      https://github.com/llvm/llvm-project/commit/509f5c4ec2dbae99713ac6292c3a6bd7ba50027c
  Author: hgreving <hgreving at hendrik-laptop.lan>
  Date:   2020-08-03 (Mon, 03 Aug 2020)

  Changed paths:
    M llvm/include/llvm/MC/MCContext.h
    M llvm/lib/MC/MCContext.cpp
    M llvm/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp
    M llvm/lib/Target/Hexagon/Disassembler/HexagonDisassembler.cpp
    M llvm/lib/Target/Hexagon/HexagonMCInstLower.cpp
    M llvm/lib/Target/Hexagon/MCTargetDesc/HexagonAsmBackend.cpp
    M llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCCompound.cpp

  Log Message:
  -----------
  [MC] Fix memory leak when allocating MCInst with bump allocator

Adds the function createMCInst() to MCContext that creates a MCInst using
a typed bump alloctor.

MCInst contains a SmallVector<MCOperand, 8>. The SmallVector is POD only
for <= 8 operands. The default untyped bump pointer allocator of MCContext
does not delete the MCInst, so if the SmallVector grows, it's a leak.

This fixes https://bugs.llvm.org/show_bug.cgi?id=46900.




More information about the All-commits mailing list