[llvm] r248372 - [dsymutil] Plug a memory leak.

Frédéric Riss via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 23 08:10:00 PDT 2015


Thanks Ben!

Adrian, can you double check that the allocated unit doesn’t need to survive after we clone its DIEs. I don’t think so, but you know that part better than me.

Fred

> On Sep 23, 2015, at 3:38 AM, Benjamin Kramer via llvm-commits <llvm-commits at lists.llvm.org> wrote:
> 
> Author: d0k
> Date: Wed Sep 23 05:38:59 2015
> New Revision: 248372
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=248372&view=rev
> Log:
> [dsymutil] Plug a memory leak.
> 
> Modified:
>    llvm/trunk/tools/dsymutil/DwarfLinker.cpp
> 
> Modified: llvm/trunk/tools/dsymutil/DwarfLinker.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/DwarfLinker.cpp?rev=248372&r1=248371&r2=248372&view=diff
> ==============================================================================
> --- llvm/trunk/tools/dsymutil/DwarfLinker.cpp (original)
> +++ llvm/trunk/tools/dsymutil/DwarfLinker.cpp Wed Sep 23 05:38:59 2015
> @@ -3157,7 +3157,7 @@ void DwarfLinker::loadClangModule(String
>   // FIXME: At this point dsymutil should verify the DW_AT_gnu_dwo_id
>   // against the module hash of the clang module.
> 
> -  CompileUnit *Unit = nullptr;
> +  std::unique_ptr<CompileUnit> Unit;
> 
>   // Setup access to the debug info.
>   DWARFContextInMemory DwarfContext(*ErrOrObj);
> @@ -3172,7 +3172,7 @@ void DwarfLinker::loadClangModule(String
>                << " 1 compile unit.\n";
>         exitDsymutil(1);
>       }
> -      Unit = new CompileUnit(*CU, UnitID++, !Options.NoODR);
> +      Unit = llvm::make_unique<CompileUnit>(*CU, UnitID++, !Options.NoODR);
>       Unit->setHasInterestingContent();
>       gatherDIEParents(CUDie, 0, *Unit, &ODRContexts.getRoot(), StringPool,
>                        ODRContexts);
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list