PKEuS
8788e58cbb
Fixed false positive #5327 : fclose as inner function call
2014-09-30 13:55:21 +02:00
PKEuS
c0e2adf723
Detect "var += fclose(f)" as deallocation (fixes false positive #6016 )
2014-09-30 13:19:53 +02:00
PKEuS
03b1afc28c
Loops over all varIds should start at 1.
2014-09-28 09:47:11 +02:00
PKEuS
e1218cf846
Support allocation of array of pointers with operator new in checkmemoryleak.cpp
2014-09-27 11:25:08 +02:00
PKEuS
2d608890a5
Improved message 'mismatchSize' ( #4167 )
2014-09-02 09:38:40 +02:00
PKEuS
0995b85c09
Attempt to fix crashs when self-checking cppcheck introduced by previous commit
2014-09-01 14:12:43 +02:00
PKEuS
40e5dab9dc
Refactorization in checkmemoryleak.cpp:
...
- Use Library to detect noreturn/notnoreturn functions
- Removed realloc from std.cfg as long as there is no proper way to configure such functions
2014-09-01 13:54:33 +02:00
Dmitry-Me
eace67ee1c
Use logical instead of bitwise operators to save cpu
2014-08-30 11:35:25 +02:00
Dmitry-Me
9829e0b48a
Clearer variable names, fix typo in comment.
2014-07-11 11:33:09 +04:00
Alexander Mai
0f7071a000
Fix clang and coverity warnings
2014-06-12 20:03:11 +02:00
PKEuS
01a0154daa
Fixed false positive #5848
2014-05-21 13:45:36 +02:00
Daniel Marjamäki
01d14d0388
Library: Refactoring alloc/dealloc functions. Normally the token should be passed so extra validation can be made
2014-04-20 14:59:16 +02:00
Daniel Marjamäki
44a66e6a5a
Fixed #1416 (false negative resource leak when calling fdopen)
2014-04-20 10:50:32 +02:00
Daniel Marjamäki
a9943fe6d0
Fixed #5525 (Closing a socket file descriptor gives an error: Mismatching allocation and deallocation)
2014-04-18 17:05:44 +02:00
Daniel Marjamäki
b909aa0e4f
CheckMemoryLeak: moved 'popen' into posix scope
2014-04-18 16:30:16 +02:00
Daniel Marjamäki
d7e2e3bd5e
Fixed #5502 (FP: Dereferencing 'b' after it is deallocated / released)
2014-04-06 18:45:24 +02:00
Daniel Marjamäki
06618b31bb
Fixed #5574 (False positive: mismatchAllocDealloc using realloc() and free)
2014-03-17 16:10:54 +01:00
Lauri Nurmi
70a67eaf85
Change some more 0 literals into nullptr.
2014-02-16 13:38:50 +02:00
Daniel Marjamäki
209dffbe1b
use nullptr in lib/checkmemoryleak.cpp
2014-02-15 16:17:56 +01:00
Daniel Marjamäki
fd3a8a2a18
Update copyright
2014-02-15 07:45:39 +01:00
Pavel Roschin
0dd227419d
CheckMemoryLeak: use library while checking whitelist functions
2014-02-05 12:16:50 +04:00
Daniel Marjamäki
30b56437c1
Merge pull request #226 from scriptum/rpg-fix-function-parameter
...
CheckMemoryLeak: improve leak checking in function parameters
2014-01-28 20:32:56 -08:00
Pavel Roschin
2396073262
CheckMemoryLeak: improve leak checking in function parameters
2014-01-28 17:30:36 +04:00
Daniel Marjamäki
2b8cf462c9
CheckMemoryLeak: Move posix-opendir/closedir to library
2014-01-26 17:02:36 +01:00
Daniel Marjamäki
4eb746d7cc
Tokenizer: Removed simplifyComparisonOrder
2014-01-17 17:25:56 +01:00
Zachary Blair
7a6386bc4b
Fixed #4867 (Memory Leak: Return value of malloc)
2014-01-03 10:12:32 +01:00
Daniel Marjamäki
f2661dae4c
astyle formatting
2013-12-29 13:44:13 +01:00
Daniel Marjamäki
e13aa0dbc3
Fixed #5275 (FP mismatchAllocDealloc: user defined opendir()/closedir() on non-POSIX system)
2013-12-29 09:51:29 +01:00
Daniel Marjamäki
57ecdd693c
Fixed #5149 (false positive: (error) Dereferencing 'memory' after it is deallocated / released)
2013-12-14 07:37:24 +01:00
Daniel Marjamäki
d2493fa3cb
CheckMemoryLeak: Report OtherRes leaks as resource leak
2013-12-12 18:23:42 +01:00
Alexander Mai
6eab4abaf2
Fixed #5030 (Segmentation fault below CheckMemoryLeakStructMember::isMalloc())
2013-09-21 18:10:29 +02:00
XhmikosR
b2e140389f
* Move system includes before local ones
...
* Remove superfluous newlines
2013-07-31 18:21:06 +03:00
Alexander Mai
7a324cef25
Fixed various Cppcheck inconclusive warnings
2013-07-30 12:52:27 +02:00
Daniel Marjamäki
be5e4ccfd5
Library: Renamed <ignore> to <leak-ignore>
2013-07-20 13:12:24 +02:00
Daniel Marjamäki
9c67af058a
SymbolDatabase: Renamed Variable::varId() to Variable::declarationId() to make it more clear how it works.
2013-07-20 12:31:04 +02:00
Daniel Marjamäki
f02e885b42
CheckMemoryLeakInFunction: Use <ignore> info from Library
2013-07-19 07:50:54 +02:00
Daniel Marjamäki
7d47fd65a2
Renamed --environment to --library. Added --check-library. Renamed Environment to Library
2013-07-08 18:26:18 +02:00
Daniel Marjamäki
61e1dd5096
Environment: Refactoring and cleanup
2013-07-05 20:55:31 +02:00
Daniel Marjamäki
6b2bab535b
CLI,LIB: Added --std setting for GTK
2013-06-29 12:55:24 +02:00
Daniel Marjamäki
ae7363fe54
Fixed #4599 (False positive with fopen/fclose test)
2013-05-23 06:34:22 +02:00
Daniel Marjamäki
cf75e2bb28
astyle formatting
2013-04-30 06:44:50 +02:00
Baris Demiray
548dd42aaf
Fixed #933 (Leaks with struct members not detected)
2013-04-26 16:11:57 +02:00
Frank Zingsheim
54e7c8f6a2
Implemented support for move constructors:
...
Adapt code to Function::eMoveConstructor
introduced in commit eb2962792f
2013-04-10 21:57:22 +02:00
PKEuS
c5d636c074
Replaced C function bsearch with std::binary_search
2013-04-03 01:35:08 -07:00
PKEuS
7bc729bc63
- Moved more functionality from Scope to Type: BaseInfo and FriendInfo
...
- Replaced Scope->findQualifiedScope by SymbolDatabase::findScope
- Improved SymbolDatabase::findType
2013-03-05 06:28:40 -08:00
PKEuS
66a3555897
Implement initial support for Types in Symboldatabase:
...
- For each class/struct/union, a Type instance is added to SymbolDatabase::typeList.
- A scope is no longer created for declared but not defined types
Fixed name detection for classes when they are declared like this: "class ::Foo::Sub {..."
2013-03-05 04:33:38 -08:00
PKEuS
d78c06dc3f
Replaced _settings->isEnabled("style") by _settings->isEnabled("warning") wherever warnings are issued
2013-03-03 02:41:59 -08:00
PKEuS
0105f8223c
Simplified several Token::Match/simpleMatch calls when match string consists of a single pattern
...
Fixed two CheckInternal error messages
2013-03-01 03:42:04 -08:00
PKEuS
f899e6ca30
Changed behaviour of %op% pattern accordingly to changes to Token::isOp(). Added %cop% as replacement for old %op%
2013-03-01 02:43:59 -08:00
PKEuS
670c4de8a9
Changed behaviour of Token::is*Op() functions:
...
- Rename Token::isOp() to Token::isConstOp() (indicating that the operator does _not_ modify the input variables)
- Create new Token::isOp(), returning true also for ++, -- and assignment operators
- Make Token::isExtendedOp() returning also true for all assignment and ++/-- operators
2013-02-28 12:50:29 -08:00
Daniel Marjamäki
2edf95a1b9
Fixed #4367 (false positive: Class '...' is unsafe, '...' can leak by wrong usage)
2013-02-24 08:14:25 +01:00
Daniel Marjamäki
bd7e3cbac5
Fixed #4540 (memory leak not detected ('.' or '->' is used before Function))
2013-01-31 17:00:50 +01:00
Robert Reif
ec1c86c152
Symbol database: more function/variable cleanup. Ticket: #4494
2013-01-31 06:41:18 +01:00
Robert Reif
859793731d
SymbolDatabase: Refactor findFunction handling. Ticket: #4494
2013-01-28 06:47:48 +01:00
Daniel Marjamäki
f86e83d813
Memory leaks: Improved handling of allocation functions that contains ::. Ticket: #4494
2013-01-22 21:33:39 +01:00
Andrew C. Martin
4a73c93750
Fix compiler warnings and comment/string typos
...
- fix g++ warning:
> lib/checkother.cpp:3779: warning: comparison between signed and unsigned integer expressions
- fix suncc warning (see [everything2](http://everything2.com/title/C%252B%252B%253A+static+extern+%2522C%2522 )):
> "lib/checkmemoryleak.cpp", line 578: Warning (Anachronism): Formal argument __compar of type extern "C" int(*)(const void*,const void*) in call to bsearch(const void*, const void*, unsigned long, unsigned long, extern "C" int(*)(const void*,const void*)) is being passed int(*)(const void*,const void*).
- prefer empty() / isEmpty() over "size() > 0" (cases not caught by stlSize)
- fix word misspellings (mostly comments, a few output lines)
- Parenthesis => Parentheses (both variations were used in the codebase)
- fix typo and wording ("never alwayw") in gui/test/data/benchmark/simple.cpp's CheckOther::unsignedPositive():
```
- "An unsigned variable will never alwayw be positive so it is either pointless or "
+ "An unsigned variable can't be negative so it is either pointless or "
```
2013-01-16 07:37:07 -07:00
Reijo Tomperi
5d5f7085bf
Updating year 2012 -> 2013 to .cpp and .h files and man page.
2013-01-01 18:29:08 +02:00
acm4me
7da155c8ba
Support for Sun Studio C++ compiler
2012-12-27 11:51:12 +01:00
Daniel Marjamäki
a84d21f271
CheckMemoryLeaksInFunction: Fixed problems with catch and function calls. Ticket: #4405
2012-12-16 18:06:40 +01:00
Frank Zingsheim
327db15284
Fix #4045 : memory leak not reported after usage of " + p[]"
2012-12-09 08:59:21 +01:00
Daniel Marjamäki
1c4afbce8c
Cleanup: Removed += and -= patterns from the checks. These should be simplified.
2012-11-30 07:08:16 +01:00
Robert Reif
35c2b8058d
Fixed #3190 (SymbolDatabase: Parse of sub class constructor fails)
2012-11-30 06:03:58 +01:00
PKEuS
17b720ef7d
Refactorization: Removed unnecessary code. Variable::typeStartToken() and Variable::typeEndToken() never point to "const".
...
Ran AStyle
2012-11-11 13:32:19 +01:00
Daniel Marjamäki
38213f1f2f
Fixed #4237 (False positive: (error) Memory Leak: data (assign reference variable value to a shadow variable in inner scope))
2012-10-27 16:36:14 +02:00
Daniel Marjamäki
863441afe8
Fixed #4236 (False positive: pointer free()d twice - neglecting call to other function)
2012-10-25 19:41:18 +02:00
Edoardo Prezioso
39a5768e9d
Fixed cppcheck message found in lib:
...
[lib/checkmemoryleak.cpp:869]: (style) The scope of the variable 'realloc' can be reduced.
And since realloc is never used, for now I commented all the lines where 'realloc' is declared/used.
2012-10-25 14:05:53 +02:00
Edoardo Prezioso
11b0047063
Fix some clang analyzer messages.
...
CheckMemoryLeak: two redundant assignments, should be clarified;
TemplateSimplifier: same;
Tokenizer: same.
2012-10-24 03:17:56 +02:00
Robert Reif
d1fad4b762
speed up checkmemoryleak by caching commonly looked up stuff in the symbol database ( #4266 )
2012-10-21 09:07:51 +02:00
Edoardo Prezioso
4ddcde1e6f
CheckMemoryLeak: add '?1:0' to clarify the value of the argument to 'deleteNext'; Tokenize.cpp: in simplifyCompoundAssignment(), remove ':' odd code used to fix a weird test case ('case' code not inside a function body), remove useless 'tok->next() != NULL' check (already true by previous condition); in simplifyConditionOperator(), handle better the parenthesis skipping code and remove useless ')'check; in simplifyQuestionMark(), remove useless 'tok->tokAt(-2)' check (Token::Match returns false if the token is NULL), add more patterns to Token::Match to handle more test cases; in simplifyBitFields(), add 'const' to 'offset' bool. RedirectOutputError: style nitpick change to declaration of a pointer.
2012-10-19 14:19:52 +02:00
Daniel Marjamäki
b591097c87
Revert "Fixed #3190 (SymbolDatabase: Parse of sub class constructor fails)"
...
This reverts commit 1ee980184e
.
2012-10-16 19:12:27 +02:00
Robert Reif
1ee980184e
Fixed #3190 (SymbolDatabase: Parse of sub class constructor fails)
2012-10-16 06:11:28 +02:00
PKEuS
508e9394d3
Added some nullpointer-checks and removed some redundant ones based on VS2012 code analysis results.
2012-09-17 15:22:51 +02:00
XhmikosR
6e4e3dfbfb
lib: tabs to spaces, remove trailing spaces and extra empty lines at the end of files
2012-09-17 13:51:23 +02:00
PKEuS
2db1dbe2ce
Changed some function prototypes according to cppcheck messages about functions that can be static.
2012-09-11 19:19:11 +02:00
PKEuS
22a8e3f4e6
Replaced Tokenizer::getFunctionTokenByName() by SymbolDatabase::findFunctionByName(), which handles scopes slightly better.
2012-09-11 18:03:47 +02:00
Daniel Marjamäki
54f1771938
Fixed #4082 (Maybe false positive: memleak)
2012-09-10 17:27:41 +02:00
PKEuS
8c70778b70
Refactorization: Fixed several messages when self-checking cppcheck
2012-09-04 15:29:51 +02:00
Daniel Marjamäki
0ead18122d
Fixed #3695 (False positive: memory leak (ptr?free(ptr):0))
2012-07-27 12:25:20 +02:00
Daniel Marjamäki
e6f761126c
Fixed #2802 (False positive: ::free() is not recognised as free() to release buffers)
2012-07-24 09:28:08 +02:00
Daniel Marjamäki
a768b0e8b2
Fixed #3954 (Pointer reference memory leak false positive)
2012-07-17 16:28:34 +02:00
PKEuS
5caab6ba10
Fixed crash on garbage code ( #3870 )
2012-07-06 09:03:33 -07:00
Edoardo Prezioso
fa24fff3dc
Fixed the warning with GCC 4.7.1:
...
cast from type ‘const void*’ to type ‘const char**’ casts away qualifiers.
2012-07-02 19:37:30 +02:00
Daniel Marjamäki
0042ee7bc8
Fixed #3660 (False positive memleak (allocation function uses non-local variable))
2012-06-25 20:00:50 +02:00
Daniel Marjamäki
72d24ab4b4
Fixed #3904 (false positive memory leak with linked list)
2012-06-23 20:15:58 +02:00
Daniel Marjamäki
a823d29da3
Fixed #3809 (false positive: memory leak)
2012-06-01 19:01:19 +02:00
Daniel Marjamäki
2e41510e30
Fixed #3806 (Possible leak in public function. The pointer '' is not deallocated before it is allocated)
2012-05-29 21:13:34 +02:00
PKEuS
9dc8123151
Refactorizations:
...
- Use const string references instead of const strings copies when possible
- Fixed cppcheck warning about postfix increment in CheckIO
- Use symbolDatabase to detect pointers in CheckOther::checkAssignBoolToPointer
2012-05-25 03:09:41 -07:00
PKEuS
dc64ac2918
Removed unnecessary variable Function::start - The value is already stored in Function::functionScope->classStart.
2012-05-22 12:58:46 -07:00
PKEuS
4bb2a1b27b
Made some functions static or const according to cppcheck results
2012-05-17 01:33:24 -07:00
PKEuS
db914d7185
Fixed compiler errrors and warnings mentioned in #3783
2012-05-07 06:34:47 -07:00
PKEuS
6ef92c4fd7
Use recently implemented new constructor of ErrorLogger::ErrorMessage in checkmemoryleak.cpp and symboldatabase.cpp
...
Fixed test failure introduced in f105bf75a6
2012-05-06 04:01:56 -07:00
PKEuS
1a5fbd61d2
Splitted class TokenList from Tokenizer
2012-05-05 09:33:26 -07:00
PKEuS
04704ac5fa
Refactorizations in checkmemoryleak.cpp:
...
- Use symbolDatabase more often to increase performance and accuracy.
- Replaced indendation counter
- Replaced custom stringify implementation
Benchmark results (sqlite checking):
4% complete, 7% on "Memory leaks (function variables)", 9% on "Memory leaks (address not taken)" and 82% on "Memory leaks (struct members)"
2012-05-03 10:43:47 +02:00
PKEuS
0d5198ffb9
Refactorization in checkmemoryleak.cpp:
...
- Fix #347 : Added support for vasprintf
- Use %varid% instead of the variable name
2012-04-26 18:56:58 +02:00
PKEuS
5086ae7c31
Refactorizations in CheckMemoryLeakInClass::variable
...
- Bailout for functions that are not implemented (should fix performance downgrade introduced in fb4709f
)
- Jump behind arguments
- Removed unnecessary pop_back operations - container gets destroyed after it.
2012-04-23 15:23:01 +02:00
PKEuS
710fefeef0
Refactorizations:
...
- Replaced some indendation counters by Token::link() or usage of symbolDatabase
- Use Token::nextArgument() to jump to target parameter
2012-04-21 23:05:37 +02:00
Daniel Marjamäki
8e3f1702fd
Reverted 81318b3f
to get rid of #3669 false positives
2012-04-10 13:58:59 +02:00
Pierre Schweitzer
9d002916f4
Fix line number displayed on leakNoVarr error
2012-03-20 22:28:56 +01:00
Pierre Schweitzer
544a1f714e
Updated error message about not taking return value from function that returns allocated memory
2012-03-18 13:45:50 +01:00
Daniel Marjamäki
1e125dc017
Fixed #3671 (False positive: Resource leak: fd)
2012-03-18 11:54:09 +01:00