Francois Gouget wrote: > 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. Ok, as there are no false positives i have improved the script a little; documented it on my Smatch page and added it to my daily Smatch run. If you know more functions that return a file_handle i can search for those too. At the moment i'm looking only for the regexp "CreateFile[AW]?".
> [...] > >>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... Send a patch too for the additional occurence that the improved script has found. bye michael -- Michael Stefaniuc Tel.: +49-711-96437-199 Sr. Network Engineer Fax.: +49-711-96437-111 Red Hat GmbH Email: [EMAIL PROTECTED] Hauptstaetterstr. 58 http://www.redhat.de/ D-70178 Stuttgart