Improve the code by static code analysis [1/3]: Bug fixesamule-svn-r10782
commit6ee694c0309d017ebcd10979a429de96277f783d
authorupstream svn <svn@amule.org>
Fri, 11 May 2012 18:38:32 +0000 (11 18:38 +0000)
committerDévai Tamás <gonosztopi@amule.org>
Fri, 11 May 2012 20:07:15 +0000 (11 20:07 +0000)
tree19208fd1d2e6fdb2fb0916ea00d87c1991e26f47
parent42950c9cf98d3644582581de79d787b908f51339
Improve the code by static code analysis [1/3]: Bug fixes

Using the results cppcheck gave on the aMule source tree, the following fixes
were made:

- Fix possible memory leaks:
  - Mismatching allocation/deallocation.
  - A common realloc() mistake: on failure the result is nulled but not freed.
- Fix resource leaks.
- Fix misused code paths (missing break on a case label).
- Fix reusing invalidated iterators.
- Fix possible NULL pointer dereferences.
- Remove unreachable code (break after throw).
- Fix: scanf() without field width specifications may crash on huge input.

Also regenerated the parsers and lexical scanners.
32 files changed:
.svn-revision
src/EncryptedDatagramSocket.cpp
src/ExternalConnector.cpp
src/IPFilterScanner.cpp
src/KnownFile.cpp
src/MemFile.cpp
src/OtherFunctions.cpp
src/OtherFunctions.h
src/Parser.cpp
src/Parser.hpp
src/PartFile.cpp
src/Proxy.cpp
src/Scanner.cpp
src/Scanner.h
src/Scanner.l
src/ServerSocket.cpp
src/TextClient.cpp
src/amule-remote-gui.h
src/amule.cpp
src/kademlia/kademlia/Indexed.cpp
src/utils/aLinkCreator/src/ed2khash.cpp
src/utils/aLinkCreator/src/md4.cpp
src/utils/cas/configfile.c
src/utils/cas/configfile.h
src/utils/cas/lines.c
src/webserver/src/WebServer.cpp
src/webserver/src/php_core_lib.cpp
src/webserver/src/php_lexer.c
src/webserver/src/php_lexer.l
src/webserver/src/php_parser.c
src/webserver/src/php_parser.h
unittests/tests/FormatTest.cpp