[Top][All Lists]

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

[Bug gas/29256] A Potential Memory Leak Bug

From: cvs-commit at gcc dot gnu.org
Subject: [Bug gas/29256] A Potential Memory Leak Bug
Date: Fri, 17 Jun 2022 11:59:37 +0000


--- Comment #1 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot 
gnu.org> ---
The master branch has been updated by Alan Modra <amodra@sourceware.org>:


commit 15797439805b1bb92c491b9c9a72500d93c0cb5b
Author: Alan Modra <amodra@gmail.com>
Date:   Fri Jun 17 17:25:53 2022 +0930

    PR29256, memory leak in obj_elf_section_name

    When handling section names in quotes obj_elf_section_name calls
    demand_copy_C_string, which puts the name on the gas notes obstack.
    Such strings aren't usually freed, since obstack_free frees all more
    recently allocated objects as well as its arg.  When handling
    non-quoted names, obj_elf_section_name mallocs the name.  Due to the
    mix of allocation strategies it isn't possible for callers to free
    names, if that was desirable.  Partially fix this by always creating
    names on the obstack, which is more efficient anyway.  (You still
    can't obstack_free on error paths due to the xtensa
    tc_canonicalize_section_name.)  Also remove a couple of cases where
    the name is dup'd for no good reason as far as I know.

            PR 29256
            * config/obj-elf.c (obj_elf_section_name): Create name on notes
            (obj_elf_attach_to_group): Don't strdup group name.
            (obj_elf_section): Likewise.
            (obj_elf_vendor_attribute): Use xmemdup0 rather than xstrndup.

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]