Don't compare file handles to NULL
Francois Gouget
fgouget at free.fr
Thu Mar 8 07:05:03 CST 2007
On Wed, 7 Mar 2007, Michael Stefaniuc wrote:
[...]
> You mean something like
> http://people.redhat.com/mstefani/wine/smatch/scripts/file_handles.pl ?
Cool, thanks.
[...]
> Most are false positives (non NULL check before CloseHandle()).
These are not false positives. Any file handle that is not
INVALID_HANDLE_VALUE must be closed with CloseHandle(). So these checks
should be against INVALID_HANDLE_VALUE, not NULL. In fact they may
possibly be removed altogether.
[...]
> dlls/rpcrt4/rpcss_np_client.c 92 RPCRT4_RpcssNPConnect(58) Comparision
> of the file handle 'the_pipe' with 0.
> programs/rpcss/np_server.c 393 RPCSS_NPConnect(57) Comparision of the
> file handle 'the_pipe' with 0.
These two combine with what looks like a very bad file handle leak
(especially in rpcrt4).
Sending patches...
--
Francois Gouget <fgouget at free.fr> http://fgouget.free.fr/
Nouvelle version : les anciens bogues ont été remplacés par de nouveaux.
More information about the wine-devel
mailing list