Re: msvcrt: move error condition before memory allocation (found by Smatch) [1/3, resend]
28 Sep
2007
28 Sep
'07
3:55 a.m.
Lionel_Debroux <lionel_debroux(a)yahoo.fr> writes:
_wfullpath leaks some heap memory in an error paths. Found in Michael Stefaniuc's list of Wine potential bugs detected by Smatch. Fixed by moving the error treatment before the allocation, since the error treatment doesn't fire up if there was a memory allocation (due to size = MAX_PATH; assignment).
Is there anything wrong with this patch ?
Yes, you are using the size before checking if the buffer is NULL (in which case the size is meaningless), and as you said yourself the error treatment isn't used if there was an allocation, so there's no leak to fix here. -- Alexandre Julliard julliard(a)winehq.org
6647
Age (days ago)
6647
Last active (days ago)
0 comments
1 participants
participants (1)
-
Alexandre Julliard