Commit Graph

297 Commits

Author SHA1 Message Date
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
Edoardo Prezioso 4de5d87078 1)Remove newly copy of 'eraseTokens' and replace every occurrence with 'deleteNext' with right parameter.
2)General improvements to code.
2011-12-08 01:44:18 +01:00
Edoardo Prezioso 612b3c59ca 1)Implement another declaration of 'Token::eraseTokens' with parameters: the starting token and the number of times needed to call 'deleteNext'.
2)Use the overloaded 'eraseTokens' where needed instead of using consecutively 'deleteNext'.
3)Tokenizer: general optimizations about the deletion of some tokens.
4)Run astyle.
2011-12-07 02:29:03 +01:00
Edoardo Prezioso c8bbb77776 CheckMemoryLeakInFunction::simplifycode : use properly 'deleteNext' instead of 'deleteThis' or 'eraseTokens' and remove redundant conversion to 'std::string'. 2011-12-05 15:50:11 +01:00
Daniel Marjamäki fb3115a199 Fixed #3267 (False positive: resource leak in vdr-xinelib) 2011-12-03 09:53:36 +01:00
Edoardo Prezioso 767413adad 1)internal check found a 'findmatch' with simple string argument;
2)Style: uniform 'while (...)' when inside it there's an assignment;
3)Replace '0' with 'NULL' where there's comparison with a pointer.
2011-12-01 12:04:47 +01:00
Edoardo Prezioso 1084e4bece 1) Shut up GCC compiler for 'missing braces around assignment';
2) Tokenizer::simplifyGoto: Code refactoring in order to skip code inside '()|[]' parentheses without counting.
2011-11-30 20:58:39 +01:00
Daniel Marjamäki d0247f3a8d Fixed #3268 (False positive: resource leak in vdr-xineliboutput) 2011-11-30 20:07:56 +01:00
Daniel Marjamäki dcd3f4fe3d Fixed #3267 (False positive (experimental): resource leak in vdr-xinelib) 2011-11-30 19:43:02 +01:00
Daniel Marjamäki 39af75abb4 Fixed #3303 (false positive: memory leak (reference count)) 2011-11-28 20:08:29 +01:00
PKEuS 6b6f780057 code cleanups and refactorings 2011-11-26 21:02:04 +01:00
Daniel Marjamäki 50c320ef27 memory leaks: Made leak checking inconclusive instead of experimental 2011-11-25 14:47:45 +01:00
Daniel Marjamäki 345220b36f removed unused include 2011-11-22 19:54:15 +01:00
Edoardo Prezioso a32b05197d Change every 'tokAt(1)' to 'next()' and every 'tokAt(-1)' to 'previous()'.
Added a safety check to ensure that a 'previous()' call doesn't crash (not sure if it's needed or not).
2011-11-20 15:59:37 +01:00
Edoardo Prezioso 11dd3c09ce Change every 'tokAt(1)->' to 'next()->' because 'tokAt(1) == 0' is equivalent to 'next() == 0', hence the equivalent cppcheck crash. 2011-11-20 15:09:57 +01:00
Edoardo Prezioso 42e369a4b4 Change every 'tokAt(..)->link()' to 'linkAt(..)'. 2011-11-20 14:24:27 +01:00
Daniel Marjamäki 690702a742 Memory leaks: Made CheckMemoryLeakInFunction experimental 2011-11-20 14:11:22 +01:00
Edoardo Prezioso 2c64d299ca Change every 'tokAt(...)->str()' to 'strAt(...)'. 2011-11-13 13:10:59 +01:00
Daniel Marjamäki 688e290332 Memory leaks: Fixed false positive for 'char *p = strcpy(malloc(10),str);' 2011-11-11 09:07:02 +01:00
Marek Zmysłowski fed875f4a4 Fix #70 (Locate memory leaks when alloc happens in function parameter)
http://sourceforge.net/apps/trac/cppcheck/ticket/70
2011-11-07 23:50:57 +02:00
Thomas Jarosch 434fb933a8 Implement Token::findsimplematch und use it for simple patterns 2011-10-27 15:59:22 +02:00
Thomas Jarosch 54adb910ec Use Token::simpleMatch instead of Token::Match for simple patterns 2011-10-27 15:59:22 +02:00
Thomas Jarosch 6047a28902 Fixed #3185 (Add three more exit functions) 2011-10-23 12:23:53 +02:00
Jonathan Neuschäfer 4fb7865f49 fix typos using codespell
Codespell is available at http://git.profusion.mobi/cgit.cgi/lucas/codespell/.
2011-10-13 22:04:41 +02:00