Commit Graph

320 Commits

Author SHA1 Message Date
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
Daniel Marjamäki 29063098bf Fixed #3670 (false positive: Allocation with open never assigned) 2012-03-18 07:49:22 +01:00
PKEuS 60cc8296c3 Fixed crash in checkmemoryleak.cpp reported by HeisSpiter 2012-03-17 11:34:27 +01:00
PKEuS fb4709f1be Refactorizations in checkmemoryleak:
- Replaced two indendation counters and one variable storage by symboldatabase functions
- Removed zero-element at end of two static arrays
- More accurate algorithm for finding a parameter by varid
- Replaced some simple tokens by direct string comparision
- Made some functions in checkmemoryleak.h private to improve encapsulation
2012-03-16 19:52:18 +01:00
Pierre Schweitzer 81318b3f4a Detect and display an error on leaks due to return of a function that allocates something is ignored.
This fixes #3439
2012-03-14 22:24:43 +01:00
Daniel Marjamäki 45759f6f7d CheckMemoryLeak: report debug warning when variable id is 0. Ticket #3527 2012-03-14 18:54:34 +01:00
Daniel Marjamäki 9df6088ddd Revert "really fix #3527 (Internal error. Token::Match called with varid 0. Please report this to Cppcheck developers)"
This reverts commit a37031944e.

I don't want this hard coding of macro names. Feel free to come with a more generic solution if you want.
2012-01-30 06:15:41 +01:00
Robert Reif 415aaca6dd Merge branch 'master' of git://github.com/danmar/cppcheck 2012-01-28 20:59:51 -05:00
Robert Reif a37031944e really fix #3527 (Internal error. Token::Match called with varid 0. Please report this to Cppcheck developers) 2012-01-28 20:58:51 -05:00
Edoardo Prezioso 697af4f7be Improve 'CheckMemoryLeakInClass::check'. 2012-01-28 23:24:00 +01:00
Daniel Marjamäki 46b8dc5e16 Fixed #3527 (Internal error. Token::Match called with varid 0. Please report this to Cppcheck developers) 2012-01-28 10:00:41 +01:00
Edoardo Prezioso 05f16a25af Fixed ticket #2405 (debug messages provide incorrect file:line information) 2012-01-06 15:15:52 +01:00
Reijo Tomperi 8cae17fda8 Update year to 2012 2012-01-01 01:05:37 +02:00
Daniel Marjamäki 6d98406d71 Fixed #3444 (False positive using putenv) 2011-12-29 07:35:27 +01:00
Daniel Marjamäki 9593e14d72 Removed debug variables 2011-12-27 09:27:46 +01:00
PKEuS dca03c3ce2 Remove unnecessary includes
Also add a unit test related to #3427
Also improve the description text in checkclass and remove unused variable.
2011-12-23 23:31:48 +02:00
Edoardo Prezioso 4cad5d4df4 Workaround fixes to shut up some cppcheck '--inconclusive' whinings. 2011-12-13 00:24:34 +01:00
PKEuS 9fc7453917 Memory leaks: Code cleanups 2011-12-10 11:55:14 +01:00
PKEuS 167a7e3e51 Various code cleanups 2011-12-08 21:28:34 +01:00