[llvm] e63b18b - Catch an extremely obvious memory leak, thanks asan

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 12 16:46:46 PDT 2021


Any chance of using unique_ptr to reduce the chance of these sort of errors?

On Tue, Jun 29, 2021 at 7:48 AM Jeremy Morse via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
>
>
> Author: Jeremy Morse
> Date: 2021-06-29T15:47:17+01:00
> New Revision: e63b18bc84a27718266f5c838a572ba423f70a2c
>
> URL: https://github.com/llvm/llvm-project/commit/e63b18bc84a27718266f5c838a572ba423f70a2c
> DIFF: https://github.com/llvm/llvm-project/commit/e63b18bc84a27718266f5c838a572ba423f70a2c.diff
>
> LOG: Catch an extremely obvious memory leak, thanks asan
>
> https://lab.llvm.org/buildbot/#/builders/5/builds/9208
>
> (dbg-phis-merging-in-ldv.mir and dbg-phis-with-loops.mir in the asan
>  check stage)
>
> Added:
>
>
> Modified:
>     llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
>
> Removed:
>
>
>
> ################################################################################
> diff  --git a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
> index 8e0588241bb2..75e551b66518 100644
> --- a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
> +++ b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
> @@ -3574,6 +3574,9 @@ class LDVSSAUpdater {
>    LDVSSAUpdater(LocIdx L, ValueIDNum **MLiveIns) : Loc(L), MLiveIns(MLiveIns) {}
>
>    void reset() {
> +    for (auto &Block : BlockMap)
> +      delete Block.second;
> +
>      PHIs.clear();
>      UndefMap.clear();
>      BlockMap.clear();
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list