Lionel_Debroux lionel_debroux@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.