aboutsummaryrefslogtreecommitdiff
path: root/gdb/printcmd.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2022-06-17 17:25:53 +0930
committerAlan Modra <amodra@gmail.com>2022-06-17 21:10:06 +0930
commit15797439805b1bb92c491b9c9a72500d93c0cb5b (patch)
treef2209bddb16dae0edb7a13ae8ee6aa4324801deb /gdb/printcmd.c
parentd6e1d48c83b165c129cb0aa78905f7ca80a1f682 (diff)
downloadbinutils-15797439805b1bb92c491b9c9a72500d93c0cb5b.zip
binutils-15797439805b1bb92c491b9c9a72500d93c0cb5b.tar.gz
binutils-15797439805b1bb92c491b9c9a72500d93c0cb5b.tar.bz2
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 obstack. (obj_elf_attach_to_group): Don't strdup group name. (obj_elf_section): Likewise. (obj_elf_vendor_attribute): Use xmemdup0 rather than xstrndup.
Diffstat (limited to 'gdb/printcmd.c')
0 files changed, 0 insertions, 0 deletions