bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/21943] New: Memory leak in asymbol.name


From: qiyao at gcc dot gnu.org
Subject: [Bug binutils/21943] New: Memory leak in asymbol.name
Date: Fri, 11 Aug 2017 13:13:25 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=21943

            Bug ID: 21943
           Summary: Memory leak in asymbol.name
           Product: binutils
           Version: 2.30 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: qiyao at gcc dot gnu.org
  Target Milestone: ---

$ valgrind --leak-check=full ./objdump  -d /tmp/1.x86.exe
....
==20024== 50 bytes in 1 blocks are definitely lost in loss record 1 of 1
==20024==    at 0x4C2AB80: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==20024==    by 0x44E302: bfd_malloc (libbfd.c:193)
==20024==    by 0x459987: elf_x86_64_get_synthetic_symtab (elf64-x86-64.c:6935)
==20024==    by 0x408226: dump_bfd (objdump.c:3525)
==20024==    by 0x408ACF: display_object_bfd (objdump.c:3603)
==20024==    by 0x408ACF: display_any_bfd (objdump.c:3692)
==20024==    by 0x40AD63: display_file (objdump.c:3713)
==20024==    by 0x404E2D: main (objdump.c:4015)

$ cat /tmp/1.c 
#include <stdio.h>

int main (void)
{
  printf ("hello\n");
  return 0;
}

elf_x86_64_get_synthetic_symtab malloc asymbol.name, but caller of
elf_x86_64_get_synthetic_symtab only free asymbol, so asymbol.name is leaked.

Note that some targets don't leak, because their get_synthetic_symtab allocate
memory for both asymbol and asymbol.name.  AArch64, ARM and MIPS do so.

$ valgrind --leak-check=full ./objdump  -d /tmp/1.aarch64.exe
....
==20045== LEAK SUMMARY:
==20045==    definitely lost: 0 bytes in 0 blocks
==20045==    indirectly lost: 0 bytes in 0 blocks
==20045==      possibly lost: 0 bytes in 0 blocks
==20045==    still reachable: 744 bytes in 31 blocks
==20045==         suppressed: 0 bytes in 0 blocks

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]