[PATCH] libdw: Don't free uninitialized Dwarf_Abbrev_Hash's of "fake" CUs.
Mark Wielaard
mark@klomp.org
Fri Nov 1 09:00:00 GMT 2019
On Thu, Oct 31, 2019 at 06:42:18PM -0500, Jonathon Anderson wrote:
> fake_{loc,loclists,addr}_cu are Dwarf_CUs that are created separate from
> all the others, so their contents are minimal and mostly initialized by
> a calloc. On dwarf_end however, they are freed through the same code path
> as all the others, so they call DAH_free like all the others. This changes
> that so that these three are exempt from DAH and split-DWARF matters, and
> swaps the calloc for a malloc so Memcheck will catch any others.
> ---
> > The Dwarf_Abbrev_Hash_free looks in the correct place. But I don't
> > believe the Free split dwarf hunk should not be under the same if
> > not-fake block.
>
> That can be fixed.
>
> I don't really like `unit_type = 0`, but its the only value that isn't one
> of the DW_UT values. And its what the calloc would've done.
O! Sorry. I now see your original approach was actually correct. For
some reason I believed the fake cus could have a split DWARF. But of
course they never have. The reason I gave was wrong, but I still like
this patch a little better because it more explicitly sets the needed
values. Your original approach however makes more sense if you like
valgrind memcheck to catch more issues.
Could you add a Signed-off-by and ChangeLog entry?
Either for your original patch or this one. Whichever you like best..
Thanks,
Mark
More information about the Elfutils-devel
mailing list