[llvm] r191638 - Plug a memory leak in a unit test. Stack allocation is sufficient here.

Eric Christopher echristo at gmail.com
Sun Sep 29 10:19:03 PDT 2013


Thanks :)

-eric

On Sun, Sep 29, 2013 at 4:29 AM, Benjamin Kramer
<benny.kra at googlemail.com> wrote:
> Author: d0k
> Date: Sun Sep 29 06:29:20 2013
> New Revision: 191638
>
> URL: http://llvm.org/viewvc/llvm-project?rev=191638&view=rev
> Log:
> Plug a memory leak in a unit test. Stack allocation is sufficient here.
>
> Modified:
>     llvm/trunk/unittests/CodeGen/DIEHashTest.cpp
>
> Modified: llvm/trunk/unittests/CodeGen/DIEHashTest.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/CodeGen/DIEHashTest.cpp?rev=191638&r1=191637&r2=191638&view=diff
> ==============================================================================
> --- llvm/trunk/unittests/CodeGen/DIEHashTest.cpp (original)
> +++ llvm/trunk/unittests/CodeGen/DIEHashTest.cpp Sun Sep 29 06:29:20 2013
> @@ -19,11 +19,10 @@ namespace {
>  using namespace llvm;
>  TEST(DIEHashData1Test, DIEHash) {
>    DIEHash Hash;
> -  DIE *Die = new DIE(dwarf::DW_TAG_base_type);
> -  DIEValue *Size = new DIEInteger(4);
> -  Die->addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Size);
> -  uint64_t MD5Res = Hash.computeTypeSignature(Die);
> +  DIE Die(dwarf::DW_TAG_base_type);
> +  DIEInteger Size(4);
> +  Die.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Size);
> +  uint64_t MD5Res = Hash.computeTypeSignature(&Die);
>    ASSERT_TRUE(MD5Res == 0x540e9ff30ade3e4aULL);
> -  delete Die;
>  }
>  }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list