[binutils-gdb] Leak in i386_elf_section_change_hook

Alan Modra amodra@sourceware.org
Wed Feb 21 21:42:02 GMT 2024


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=fddee222e574dfb0f2ba9ecdc4fb1b5db13bfae9

commit fddee222e574dfb0f2ba9ecdc4fb1b5db13bfae9
Author: Alan Modra <amodra@gmail.com>
Date:   Thu Feb 22 07:41:46 2024 +1030

    Leak in i386_elf_section_change_hook
    
    notes_alloc is perfect for assorted memory you can't free easily
    and/or would rather leave freeing until just before exit.
    
            * config/tc-i386.c (i386_elf_section_change_hook): Use notes_alloc.

Diff:
---
 gas/config/tc-i386.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index ed7c4a5ea03..c56ca4a2b4b 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -17627,7 +17627,7 @@ i386_elf_section_change_hook (void)
       break;
   if (!curr)
     {
-      curr = XNEW (struct i386_segment_info);
+      curr = notes_alloc (sizeof (*curr));
       curr->subseg = info->subseg;
       curr->next = NULL;
       prev->next = curr;


More information about the Binutils-cvs mailing list