2010/12/14 Dominique Pellé wrote:
>
> clang static analyzer complains with the following warning:
>
> netbeans.c:329:6: warning: Value stored to 'sd' is never read
>            sd = mch_open(hostname, O_RDONLY, 0);
>            ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> ....
>
> File descriptor sd is leaked at line 329.
> Why is this file being opened at line 329 without being used?
> Shouldn't line 326 to 331 be removed?
>


Hi Dominique,

There is possibly a confusion between 'hostname' the parameter, and
the file from where this parameter may be read (:help
netbeans-parameters). Maybe the author wanted initially to print the
file content as a debugging help while he was writting this function ?
I agree with you that these lines should be removed.

Another problem is that 'sd' is mostly never closed in case of error.

I don't know also what is the purpose of reopening a new socket, after
the first connect has failed with ECONNREFUSED. This does not seem
useful.


-- 
Xavier

Les Chemins de Lokoti: http://lokoti.alwaysdata.net

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui