Bug 29254

Summary: A Potential Memory Leak Bug
Product: binutils Reporter: yuxuan He <1157401338>
Component: binutilsAssignee: Alan Modra <amodra>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 2.34   
Target Milestone: 2.39   
Host: Target:
Build: Last reconfirmed: 2022-06-17 00:00:00

Description yuxuan He 2022-06-16 09:16:08 UTC
Hi, I found a potential memory leak bug in the project source code of binutils, and I have shown the execution sequence of the program that may have generated the bug on a diagram(https://user-images.githubusercontent.com/87304478/174035801-cf547930-1b3e-484b-b9af-4454bcd749a3.png). The red text illustrates the steps that created the bug, the red arrows represent the call relationships, and the green text illustrates the file and function where the code snippet is located below the green text.
I look forward to your reply and thank you very much for your patience!
Comment 1 Sourceware Commits 2022-06-17 11:59:27 UTC
The master branch has been updated by Alan Modra <amodra@sourceware.org>:

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

commit 0ebc886149c22aceaf8ed74267821a59ca9d03eb
Author: Alan Modra <amodra@gmail.com>
Date:   Fri Jun 17 09:00:41 2022 +0930

    PR29254, memory leak in stab_demangle_v3_arg
    
            PR 29254
            * stabs.c (stab_demangle_v3_arg): Free dt on failure path.
Comment 2 Alan Modra 2022-06-17 12:18:59 UTC
Fixed for 2.39
Comment 3 yuxuan He 2022-06-17 12:26:51 UTC
(In reply to Alan Modra from comment #2)
> Fixed for 2.39

thank you!