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

            Bug ID: 26836
           Summary: potential memory leak in parse_args
           Product: binutils
           Version: 2.34
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: liuyingying19 at huawei dot com
  Target Milestone: ---

Test case:

#include <stdio.h>
int main()
{
    printf("Hello world!\n");
    return 0;
}

==74578==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 5664 byte(s) in 1 object(s) allocated from:
  #0 0x7fedf6816860 in __interceptor_malloc
../../.././libsanitier/asasn/asan_malloc_linux.cc:62
  #1 0x560879e0b151 in parse_args (/usr/bin/riscv32-unknown-elf-ld+03d151)

binutils version 2.34


Checked on the source code, I did not see any free action on below shortopts,
longopts, really_longopts variable.

ld/lexsup.c
  shortopts = (char *) xmalloc (OPTION_COUNT * 3 + 2);
  longopts = (struct option *)
      xmalloc (sizeof (*longopts) * (OPTION_COUNT + 1));
  really_longopts = (struct option *)
      malloc (sizeof (*really_longopts) * (OPTION_COUNT + 1));

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

Reply via email to