https://bugs.winehq.org/show_bug.cgi?id=56569
Bug ID: 56569 Summary: There is a memory leak defect at line 231 in the file negotiate.c located at /wine/dlls/secur32/. 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: ---
A pointer variable named new_ctxt is defined at line 212 in the file negotiate.c located at /wine/dlls/secur32/. This pointer allocates a block of dynamic memory using the function calloc at line 225. When the if statement at line 225 evaluates to false, it indicates that the dynamic memory allocation for new_ctxt was successful. However, when the if statement at line 231 evaluates to true, the program returns at line 231, thus skipping the release of the dynamically allocated memory pointed to by new_ctxt at line 316, resulting in a memory leak defect, as illustrated in the diagram below: https://github.com/LuMingYinDetect/wine_defects/blob/main/wine_13.png
http://bugs.winehq.org/show_bug.cgi?id=56569
Bernhard Übelacker bernhardu@mailbox.org changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |bernhardu@mailbox.org
--- Comment #1 from Bernhard Übelacker bernhardu@mailbox.org --- Hello lumingyin, the block with the calloc is just reached `if (credential)`, then handle gets assigned the value of `credential`, before the allocation by `calloc`.
Therefore if this allocation is reached, `handle` has always a non-null value.
Am I missing something, can you confirm this?
http://bugs.winehq.org/show_bug.cgi?id=56569
--- Comment #2 from Nikolay Sivov bunglehead@gmail.com --- Agreed, looks like a false positive.
http://bugs.winehq.org/show_bug.cgi?id=56569
Damjan Jovanovic damjan.jov@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |INVALID Component|-unknown |secur32 Status|UNCONFIRMED |RESOLVED CC| |damjan.jov@gmail.com
--- Comment #3 from Damjan Jovanovic damjan.jov@gmail.com --- Yes, false positive, resolving invalid.