Hi

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);
            ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The code looks wrong there indeed in
vim/src/netbeans.c (changeset 2662:916c90b37ea9):

 324     if ((host = gethostbyname(hostname)) == NULL)
 325     {
 326         if (mch_access(hostname, R_OK) >= 0)
 327         {
 328             /* DEBUG: input file */
!329             sd = mch_open(hostname, O_RDONLY, 0);
 330             goto theend;
 331         }
 332         nbdebug(("error in gethostbyname() in netbeans_connect()\n"));
 333         PERROR("gethostbyname() in netbeans_connect()");
 334         goto theend;
 ...
 429 theend:
 430     vim_free(hostname);
 431     vim_free(address);
 432     vim_free(password);
 433     return NETBEANS_OPEN ? OK : FAIL;
 434 }

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?

-- Dominique

-- 
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