Hello there,

----------------------------------------

> A new development snapshot is available from
> http://lftp.yar.ru/ftp/devel/lftp-pre4.5.0-20131206.tar.gz
>
> Please test.

I ran the static analysis checker "cppcheck" over the source code.
It found a few minor memory leaks

[lftp-pre4.5.0-20131206/lib/regcomp.c:3668]: (error) Memory leak: mbcset
[lftp-pre4.5.0-20131206/src/Bencode.cc:132]: (error) Memory leak: n
[lftp-pre4.5.0-20131206/lib/regex_internal.c:1631]: (error) Memory leak: 
newstate
[lftp-pre4.5.0-20131206/lib/regex_internal.c:1681]: (error) Memory leak: 
newstate
[lftp-pre4.5.0-20131206/lib/regcomp.c:3668]: (error) Memory leak: sbcset

I've checked all of these and they are all on error handling
paths, so they look minor to me.

It also found

[lftp-pre4.5.0-20131206/src/DHT.cc:1010]: (warning) Ineffective call of 
function 'empty()'. Did you 
intend to call 'clear()' instead?
[lftp-pre4.5.0-20131206/src/DHT.cc:1011]: (warning) Ineffective call of 
function 'empty()'. Did you 
intend to call 'clear()' instead?
[lftp-pre4.5.0-20131206/src/Fish.h:92]: (warning) Ineffective call of function 
'empty()'. Did you in
tend to call 'clear()' instead?
[lftp-pre4.5.0-20131206/src/Torrent.cc:1702]: (warning) Ineffective call of 
function 'empty()'. Did 
you intend to call 'clear()' instead?
[lftp-pre4.5.0-20131206/src/Torrent.cc:1710]: (warning) Ineffective call of 
function 'empty()'. Did 
you intend to call 'clear()' instead?
[lftp-pre4.5.0-20131206/src/Torrent.cc:1711]: (warning) Ineffective call of 
function 'empty()'. Did 
you intend to call 'clear()' instead?
[lftp-pre4.5.0-20131206/src/Torrent.cc:2141]: (warning) Ineffective call of 
function 'empty()'. Did 
you intend to call 'clear()' instead?
[lftp-pre4.5.0-20131206/src/Torrent.cc:2200]: (warning) Ineffective call of 
function 'empty()'. Did 
you intend to call 'clear()' instead?

I checked the first two and they look like bugs to me. Member function empty() 
doesn't
change anything. It would be better named isEmpty().

Some minor style issues

[lftp-pre4.5.0-20131206/src/FileCopyFtp.cc:73]: (style) Boolean result is used 
in bitwise operation.
 Clarify expression with parentheses.
[lftp-pre4.5.0-20131206/src/FileCopy.cc:1570]: (style) Clarify calculation 
precedence for '+' and '?
'.

And what might well be some pointless computation.

[lftp-pre4.5.0-20131206/src/keyvalue.cc:205]: (style) Variable 'echo' is 
assigned a value that is ne
ver used.
[lftp-pre4.5.0-20131206/lib/regcomp.c:3488]: (style) Variable 'extra' is 
assigned a value that is ne
ver used.
[lftp-pre4.5.0-20131206/lib/iconv_open.c:133]: (style) Variable 
'fromcode_upper_end' is assigned a v
alue that is never used.
[lftp-pre4.5.0-20131206/src/FtpDirList.cc:214]: (style) Variable 'group' is 
assigned a value that is
 never used.
[lftp-pre4.5.0-20131206/lib/regcomp.c:3490]: (style) Variable 'indirect' is 
assigned a value that is
 never used.
[lftp-pre4.5.0-20131206/src/Resolver.cc:486]: (style) Variable 'max_retries' is 
assigned a value tha
t is never used.
[lftp-pre4.5.0-20131206/src/Resolver.cc:685]: (style) Variable 'max_retries' is 
assigned a value tha
t is never used.
[lftp-pre4.5.0-20131206/src/HttpDir.cc:394]: (style) Variable 'perms_code' is 
assigned a value that 
is never used.
[lftp-pre4.5.0-20131206/src/HttpDir.cc:515]: (style) Variable 'perms_code' is 
assigned a value that 
is never used.
[lftp-pre4.5.0-20131206/src/Resolver.cc:485]: (style) Variable 'retries' is 
assigned a value that is
 never used.
[lftp-pre4.5.0-20131206/src/Resolver.cc:840]: (style) Variable 'retries' is 
assigned a value that is
 never used.
[lftp-pre4.5.0-20131206/src/ResMgr.cc:232]: (style) Variable 'size' is assigned 
a value that is neve
r used.
[lftp-pre4.5.0-20131206/lib/regcomp.c:3485]: (style) Variable 'table' is 
assigned a value that is ne
ver used.
[lftp-pre4.5.0-20131206/lib/iconv_open.c:149]: (style) Variable 
'tocode_upper_end' is assigned a val
ue that is never used.
[lftp-pre4.5.0-20131206/src/Torrent.cc:3447]: (style) Variable 'unpacked' is 
assigned a value that i
s never used.

As ever with cppcheck, there are likely to be some false positives.
Some, all or even none of the above might be worth fixing.

Regards

David Binderman                                           
_______________________________________________
lftp-devel mailing list
lftp-devel@uniyar.ac.ru
http://univ.uniyar.ac.ru/mailman/listinfo/lftp-devel

Reply via email to