[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    Re: msvcrt: move error condition before memory allocation (found by
From:       Alexandre Julliard <julliard () winehq ! org>
Date:       2007-09-28 8:55:52
Message-ID: 87odfnp3s7.fsf () wine ! dyndns ! org
[Download RAW message or body]

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.

-- 
Alexandre Julliard
julliard@winehq.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic