https://sourceware.org/bugzilla/show_bug.cgi?id=29255
Bug ID: 29255 Summary: A Potential Memory Leak Bug Product: binutils Version: 2.34 Status: UNCONFIRMED Severity: normal Priority: P2 Component: binutils Assignee: unassigned at sourceware dot org Reporter: 1157401338 at qq dot com Target Milestone: --- Created attachment 14146 --> https://sourceware.org/bugzilla/attachment.cgi?id=14146&action=edit diagram of memory leak bug 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,which is added to the attachment The red text illustrates the steps that created the bug the red arrows represent the call relationships the green text illustrates the file and function where the code snippet is located below the green text. In short, the key to the bug is the fourth and fifth steps in the diagram. The return value of the function called in the fourth step points to dynamically allocated memory, which should normally be further returned to the function caller, however, when the return value of the mkdir function is not equal to 0, the handling of the case simply returns the null pointer, and the dynamically allocated memory is then leaked, as shown in the diagram demonstrates. A free operation should be performed on tmpname when mkdir fails, to avoid memory leaks. 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.