[Bug libdw/23301] New: free on unitialized value

luizluca at gmail dot com sourceware-bugzilla@sourceware.org
Sun Jun 17 08:45:00 GMT 2018


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

            Bug ID: 23301
           Summary: free on unitialized value
           Product: elfutils
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libdw
          Assignee: unassigned at sourceware dot org
          Reporter: luizluca at gmail dot com
                CC: elfutils-devel at sourceware dot org
  Target Milestone: ---

Created attachment 11075
  --> https://sourceware.org/bugzilla/attachment.cgi?id=11075&action=edit
patch: dwarf_getsrclines.c: Fix unitialized usage of filelist

I'm getting this error with 0.172:

dwarf_getsrclines.c: In function 'read_srclines':
dwarf_getsrclines.c:1074:7: error: 'filelist' may be used uninitialized in this
function [-Werror=maybe-uninitialized]
       free (filelist);
       ^~~~~~~~~~~~~~~

It seems that gcc is right here as there is "ifs" that go to "out" (where
filelist is freed) before freelist is initialized. I fixed by just moving
filelist initialization to before the first usage of "goto out;". Maybe there
is a more elegant approach.

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


More information about the Elfutils-devel mailing list