https://bugs.winehq.org/show_bug.cgi?id=56567
Bug ID: 56567 Summary: There is a memory leak defect at line 580 of the file "/wine/tools/widl/write_msft.c". Product: Wine Version: 9.6 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: lumingying@bupt.edu.cn Distribution: ---
The trigger path of the defect:
1.In line 573 of the /wine/tools/widl/write_msft.c file, a pointer variable named encoded_string is defined. This pointer variable is passed as an argument to the function CTL2_ENCODE_STRING on line 575, which allocates a dynamic memory area, as shown in the following figure: https://github.com/LuMingYinDetect/wine_defects/blob/main/wine_8.png
2.The role of ctl2_encode_string is to allocate a new dynamic memory area. Specifically, a pointer variable named converted_string is defined on line 329. The converted_string pointer variable allocates a dynamic memory area through the xmalloc function on line 336, and is assigned to the function parameter result (i.e., the incoming encoded_string variable) on line 348, as shown in the following figure: https://github.com/LuMingYinDetect/wine_defects/blob/main/wine_9.png
3.After the execution of ctl2_encode_string is completed, the variable encoded_string is allocated a dynamic memory area. When the if statement on line 580 of the program is true, the program will return, thus preventing the execution of the operation to release the dynamic memory area pointed to by encoded_string on line 587. This results in a memory leak defect, as shown in the following figure. https://github.com/LuMingYinDetect/wine_defects/blob/main/wine_10.png
https://bugs.winehq.org/show_bug.cgi?id=56567
Zeb Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED CC| |z.figura12@gmail.com Resolution|--- |WONTFIX
--- Comment #1 from Zeb Figura z.figura12@gmail.com --- We don't care about memory leaks in short-lived tools.
https://bugs.winehq.org/show_bug.cgi?id=56567
Gijs Vermeulen gijsvrm@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #2 from Gijs Vermeulen gijsvrm@gmail.com --- Closing.