https://sourceware.org/bugzilla/show_bug.cgi?id=29256
Bug ID: 29256 Summary: A Potential Memory Leak Bug Product: binutils Version: 2.34 Status: UNCONFIRMED Severity: normal Priority: P2 Component: gas Assignee: unassigned at sourceware dot org Reporter: 1157401338 at qq dot com Target Milestone: --- Created attachment 14148 --> https://sourceware.org/bugzilla/attachment.cgi?id=14148&action=edit diagram of memory leak bug Hi, I found a potential memory leak bug in the project source code of binutils, I have shown the execution sequence of the program that may generate the bug on a diagram which is added to the attachment. The text in red illustrates the steps that generate the bug The red arrows represent call relationships The green text illustrates the files and functions whose code snippets are located below the green text. The purple text is the annotation of the step that caused the bug In short, the key to the bug is the fifth step in the diagram. The return value of the function called in step 5 points to dynamically allocated memory, and after that call, the return value of the function obj_elf_section_name is not passed further to the caller of function obj_elf_section, and no free operation is performed, thus a memory leak occurs. It is worth noting that although the second and third steps in the diagram show that name is a dynamically allocated memory, other defined sites of name are also dynamically allocated memory, for example, line 975 of the code fragment where the second step in the diagram is located calls the function xmemdup0, which also uses xmalloc to dynamically allocate memory and passing the return value to name I look forward to your reply and thank you very much for your patience -- You are receiving this mail because: You are on the CC list for the bug.