Commit Graph

542 Commits

Author SHA1 Message Date
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
Daniel Marjamäki 6f8e42a5af changed the astyle formatting flags 2011-10-13 20:53:06 +02:00
Marek Zmysłowski 07d8cd0a12 improved realloc checking '*p = realloc(*p,..'. Ticket: #1791 2011-10-11 22:07:14 +02:00
Daniel Marjamäki 84f190abf7 Fixed #3096 (false negative: memory leak not found when passing string to strtok) 2011-09-09 07:25:47 +02:00
Daniel Marjamäki 184e0550b8 updated comments 2011-09-08 18:23:25 +02:00
Robert Reif acebc635b5 add support for deallocating memory with realloc 2011-08-30 23:42:11 -04:00
Daniel Marjamäki a1aa66f370 Fixed #3039 (False Positive: Memory Leak 'p = pop(p);') 2011-08-28 11:28:14 +02:00
Daniel Marjamäki 15e965b530 Fixed #3038 (False Positive - memory leak (struct member passed to subfunction)) 2011-08-26 19:26:21 +02:00
Daniel Marjamäki 6d9463139d Fixed #3038 (False Positive - memory leak) 2011-08-25 19:59:44 +02:00
Daniel Marjamäki 2f0fc9444f Fixed #3041 (false positive reported for error with id='deallocuse') 2011-08-23 23:18:47 +02:00
Daniel Marjamäki dd09b24208 Fixed #3024 (False positive: memory leak for 'rc.bitmap' when rc is added to linux kernel list) 2011-08-20 09:17:34 +02:00
Daniel Marjamäki 5f25f2c6e6 Fixed #3012 (False Pos Memory Leak with a Macro) 2011-08-16 20:39:17 +02:00
Daniel Marjamäki 2150995475 Fixed #2981 (False positive: struct member leak) 2011-08-08 19:58:49 +02:00
Kimmo Varis cfcfa3f000 Use "enabled" list for the style checking.
Settings-class currently enables style checking via dedicated
boolean attribute. All other CLI's enable-options are handled
through the enable-list. This commit moves style-check enabling
to use the enable-list.

Main advantage is the consistency how options are handled/stored
in the Settings class. Which also unifies using them for the other
code. You need to enable certain type of checks? Use the
addEnabled()-method. You want to check if certain type of checks
are enabled? Use the isEnabled()-method.
2011-08-07 10:28:52 +03:00
Robert Reif 222ed6d375 fix #2971 (Wrong warning generated) 2011-08-06 19:10:15 -04:00
Daniel Marjamäki 5fc2a55bac Fixed #2900 (found memory leak in kernel p54usb and a false positive reported) 2011-08-02 09:04:13 +02:00
Daniel Marjamäki 69c3287e31 Memory leaks: fix endless loop for 'if )'. the check assumed that the link after the 'if' pointed forwards. Ticket: #2404 2011-07-31 19:38:39 +02:00
Daniel Marjamäki 4433e621f8 removed the unused function CheckMemoryLeakInFunction::matchFunctionsThatReturnArg 2011-07-31 17:36:56 +02:00
Simon Martin 50f78ce329 Fixed #2951 (Small code factorization in checkmemoryleak.cpp) 2011-07-30 13:10:44 +02:00
Daniel Marjamäki dc629b4c39 Fixed 'possible null pointer dereference' warning messages 2011-07-28 08:12:21 +02:00
Daniel Marjamäki 4e6800c474 Fixed #2921 (False positive: Memory leak with static pointer) 2011-07-24 16:08:29 +02:00
Daniel Marjamäki d34a778848 Fixed #2848 (False positive: Memory leak when assigning and freeing from another struct) 2011-07-21 13:33:20 +02:00
Robert Reif af1e51f648 fix some more false negatives for #2904 (Memory leak not detected when creating a new class instance) 2011-07-14 20:45:27 -04:00
Robert Reif 270b2b1772 fix #2904 (Memory leak not detected when creating a new class instance) 2011-07-14 19:15:59 -04:00
Reijo Tomperi 6d4799e0b8 Minor cleanup related to previous fix.
This code should not be needed anymore as tokenizer should simplify question mark away.
2011-06-30 22:10:17 +03:00
Daniel Marjamäki 6375e1d3dc Fixed #2849 (False positive: memory leak (using question mark operator)) 2011-06-30 17:31:22 +02:00
Daniel Marjamäki cacca00080 Fixed #2855 (False positive: resource leak when reusing fd) 2011-06-29 20:00:21 +02:00
Daniel Marjamäki 47a15b6486 Fixed #2830 (false positive: resource leak when using fdopen) 2011-06-20 18:42:13 +02:00
Daniel Marjamäki 1b4b4ee43e Fixed #2806 (False positive with g_strstrip()) 2011-05-29 17:44:10 +02:00
Daniel Marjamäki 52499ca8f8 Fixed #2790 (Incorrect allocation mismatch error) 2011-05-19 19:41:18 +02:00
Daniel Marjamäki 1c992fe25a Fixed #2783 (Improve check: struct member leaks when analysing c file) 2011-05-11 18:19:14 +02:00
Daniel Marjamäki a79e979ae4 Memory leaks: Fixed TODO test case. Ticket: #2733 2011-04-20 17:16:09 +02:00
Daniel Marjamäki aac65247ba Fixed #2733 (Memory leak: not all branch are checked) 2011-04-20 06:41:14 +02:00
Ettl Martin 47a1332e6a #2733 added sizeof to checkmemory-leaks white list, added a todo-testcase 2011-04-19 16:55:27 +02:00
Daniel Marjamäki 58dbbb0cab Inconclusive checking: Report inconclusive errors with reportInconclusiveError. It takes the same parameters as reportError. 2011-04-14 18:02:01 +02:00
Daniel Marjamäki e5d43d4ed2 Renamed Settings::stupid to Settings::experimental 2011-04-10 15:55:08 +02:00
Daniel Marjamäki 30ee9ba6e4 Added Settings::stupid flag that can be used to hide checking that generates false positives. 2011-04-10 13:23:45 +02:00
Daniel Marjamäki f76eb5541c Refactoring: Use %op% instead of Token::isOp 2011-04-09 18:47:01 +02:00
Daniel Marjamäki f6d910ab3d Refactoring: Use Token::isOp 2011-04-09 15:54:36 +02:00
Daniel Marjamäki 74105f5d83 Fixed #2673 (false positive: memory leak (address stored in list)) 2011-03-24 17:14:12 +01:00
Daniel Marjamäki 5f36ede4f5 Fixed #2662 (Segfault: overloaded function call function with same name) 2011-03-23 18:45:47 +01:00
Robert Reif 5cdd635701 run astyle 2011-03-22 19:20:05 -04:00
Ettl Martin ff1de4c896 extended checkmemoryleak-whitelist 2011-03-22 22:13:29 +01:00
Robert Reif 3c5134bb21 run astyle 2011-03-21 19:59:53 -04:00
Ettl Martin 7e31c91a79 extended checkmemoryleak white list 2011-03-21 23:59:43 +01:00
Ettl Martin 38cf9f26df #2667 added open(), _open() and _wopen() function to checkmemoryleak whitelist, incl. unittests; 2011-03-21 23:20:46 +01:00
Ettl Martin 78bcb07e19 #2667 added perror to checkmemoryleak white list; added unit-tests. 2011-03-21 17:43:26 +01:00
Ettl Martin f242cb639e #2668 fixed memory leak ( freopen() ) 2011-03-21 15:12:21 +01:00
Ettl Martin a975301ce4 #2659 added chown,chmod and chdir functions to checkmemoryleak white list; added unittests for each case; 2011-03-21 00:07:37 +01:00
Ettl Martin 01249d4f48 #2659 added access()-function to checkmemoryleak white-list and provided untittests. 2011-03-20 23:39:44 +01:00
Ettl Martin 7afc0978c2 #2659 added stat function to white list and provide unit tests. 2011-03-20 22:17:51 +01:00
Ettl Martin ab6888dbfe fixed ticket 2659: added lstat function to white list; provided unit-tests. 2011-03-20 21:52:25 +01:00
Daniel Marjamäki 2613780b85 Fixed #2662 (Segfault: overloaded function call function with same name) 2011-03-20 09:16:52 +01:00
Daniel Marjamäki 2dcd0128b0 Fixed #2213 (false negative: resource leak (calling allocating subfunction twice)) 2011-03-19 14:05:22 +01:00
Robert Reif 79f0fe7d1c refactor symbol database and checks to use list of Scope rather than list of Scope pointers 2011-03-10 19:43:29 -05:00
Daniel Marjamäki be33f6b945 Fixed #2635 (False positive: resource leak) 2011-03-09 19:53:59 +01:00
Daniel Marjamäki 8e571c04e4 Fixed #2633 (False positive: Memory leak for tree node) 2011-03-07 20:17:52 +01:00
Daniel Marjamäki ca4015f905 CheckMemoryLeak: Refactoring the code 2011-03-06 09:42:16 +01:00
Daniel Marjamäki 56ae77ba87 Fixed #2555 (Cppcheck 1.47 - Crash on WinMerge-Trunk (Win7 x64)) 2011-02-08 20:18:15 +01:00
Daniel Marjamäki dbc5929fa2 Fixed #2503 (false positive: memory leak (struct member, address is taken)) 2011-02-04 20:41:35 +01:00
Robert Reif 514c9b9b23 Fixed #2546 (make CheckMemoryLeakInClass also check structures) 2011-02-04 20:17:25 +01:00
Raphael Geissert f8e2d50e6f Use Token::simpleMatch where no special patterns are needed 2011-02-02 13:27:02 -06:00
Raphael Geissert 8d5863133c Use Token::simpleMatch where no patterns are used 2011-02-02 13:27:01 -06:00
Robert Reif 09998d9e18 Memory leaks: less conservative checking of classes. ticket: #2517 2011-01-30 08:38:20 +01:00
Daniel Marjamäki 0624e418f1 Memory leaks: bug fix. don't skip '}' by accident 2011-01-29 18:46:55 +01:00
Daniel Marjamäki f947955c63 Fixed #2492 (False positive: memory leak 'return &self->foo;') 2011-01-22 13:40:19 +01:00
Robert Reif d73709a620 Symbol database: rename variables. ticket: #2468 2011-01-21 07:42:41 +01:00
Robert Reif c994508c3e Symbol database: Refactor the variables API. ticket: #2468 2011-01-18 07:32:06 +01:00
Daniel Marjamäki 065e2e277e Fixed #2473 (False positive: Memory leak when there is local struct) 2011-01-17 19:00:21 +01:00
Robert Reif 959e10cee5 Symbol database: renamed classes. ticket: #2468 2011-01-17 18:29:19 +01:00
Robert Reif bf9528558e Symbol database: pulled out classes into global scope. ticket: #2468 2011-01-17 07:21:59 +01:00
Robert Reif d341b42b0c Symbol database: increased constness. ticket: #2468 2011-01-16 18:13:54 +01:00
Daniel Marjamäki 8ef47dc576 astyle formatting 2011-01-16 09:57:56 +01:00
Daniel Marjamäki 8fa26fbd28 Memory leaks: Optimised and refactored 2011-01-16 09:56:04 +01:00
Zachary Blair 38be7056b0 Fixed #2434 (FP memleakOnRealloc) 2011-01-12 22:33:46 -08:00
Daniel Marjamäki 09f900ce79 Fixed #2440 (False negative: basic memory leak) 2011-01-11 20:14:15 +01:00
Daniel Marjamäki 2d92f1ff6a Fixed #2442 (False positive: Memory leak when function returns in 'if' instead of 'else if') 2011-01-10 19:35:06 +01:00
Reijo Tomperi 226b605774 Change year 2010 -> 2011 in license texts. 2011-01-09 21:33:36 +02:00
Daniel Marjamäki 67a1c6817b Error message: Replace " with ' around variable name 2011-01-08 14:35:18 +01:00
Raphael Geissert 2b1ec9a07f Mention the name of the variable in the inconclusive leak msg 2011-01-03 20:40:31 -06:00
Daniel Marjamäki b5876f00ff Fixed #2391 (cstdlib file and memory function check misbehavior) 2011-01-02 08:32:51 +01:00
Daniel Marjamäki 2a77dd3df1 Fixed #2246 (Improve check: Memory leak, function is not noreturn if return value is taken) 2011-01-01 20:14:01 +01:00
Daniel Marjamäki 3eabb4ebe0 Added comments in the memory leaks checking 2011-01-01 13:28:34 +01:00
Daniel Marjamäki 0cc49188c0 Memory leaks: localized variables 2011-01-01 12:27:57 +01:00
Daniel Marjamäki 3d3593e6e7 Fixed #2374 (False 'memory leak' report (assigning to map in subfunction)) 2010-12-29 22:18:23 +01:00
Daniel Marjamäki 00e9822cb3 Fixed #2337 (False Positive: memory leak) 2010-12-22 18:32:00 +01:00
Daniel Marjamäki 6951c32683 Fixed #2336 (False positive: memory leak (passing pointer to subfunction)) 2010-12-21 21:12:45 +01:00
Daniel Marjamäki 814efb2512 Fixed #2313 (False Positive: memory leak) 2010-12-17 21:34:22 +01:00
Daniel Marjamäki 49ee1533d9 Fixed #2301 (false positive: The given size 3 is mismatching) 2010-12-16 21:27:33 +01:00
vBm 46a11183a5 Fixed some spelling mistakes 2010-12-15 18:45:53 +01:00
Robert Reif 4d2c210f2a Symbol database: use in checkmemoryleaks.cpp. ticket: #2219 2010-12-09 06:15:01 +01:00
Daniel Marjamäki cad9c5f232 Fixed #2285 (False Positive: memory leak) 2010-12-08 21:02:02 +01:00
Robert Reif c6e67d4aad Symbol database: use symbol database in the memory leaks function checking. Ticket: #2219 2010-12-08 07:49:01 +01:00
Robert Reif b6acfa809b Symbol database: creates a single symbol database within Tokenizer on demand and changes all checks to use it 2010-12-07 07:08:49 +01:00
Robert Reif 271d8988aa Symbol database: fixed a TODO test where class variables were qualified with the class name 2010-12-07 07:07:36 +01:00
Robert Reif 6c719c5806 Symbol database: removed unnecessary null pointer checks 2010-12-07 07:07:07 +01:00
Daniel Marjamäki 26864dd011 Memory leaks: Removed the experimental checking using ExecutionPath. 2010-12-06 21:46:18 +01:00
Robert Reif 626a814241 Symbol database: better handling of inline functions. Ticket: #2219 2010-12-05 20:26:52 +01:00
Robert Reif 758fc85a12 Memory leaks: Determine that some classes are not auto-deallocated. Reduce false negatives. Ticket: #2219 and #1618 2010-12-04 07:29:12 +01:00
Daniel Marjamäki 0081800a20 Fixed #2261 (False positive: memory leak) 2010-11-30 19:36:04 +01:00
Daniel Marjamäki 6761765a70 Fixed #2262 (False positive: Resource leak: fd) 2010-11-30 19:14:31 +01:00
Daniel Marjamäki 4de64209fb Fixed #2248 (memory leak : pointer inserted in an object) 2010-11-29 19:53:34 +01:00
Daniel Marjamäki 03a92582ca Fixed #2235 (false Resource leak) 2010-11-27 11:09:42 +01:00
Robert Reif 88a1448a07 Symbol database: refactor CheckMemoryLeakInClass::checkPublicFunctions to use the symbol database. Ticket: #2219 2010-11-25 21:04:49 +01:00
Robert Reif 1842a122da reuse symbol database in checkmemoryleak.cpp. ticket: #2219 2010-11-23 18:41:07 +01:00
Daniel Marjamäki 9ccc57a455 Fixed #2214 (Improve check: Memory leak not detected when pointer is incremented) 2010-11-20 08:35:23 +01:00
Daniel Marjamäki f7ca4f09ef Fixed #2151 (false negative: memory leak when calling subfunction that doesn't deallocate the memory) 2010-11-12 21:09:34 +01:00
Daniel Marjamäki 0328d26fcb Fixed #2192 (false positive: resource leak) 2010-11-11 17:40:20 +01:00
Daniel Marjamäki 41bbe5d0cf Fixed #2182 (Context sensitive false positive) 2010-11-10 18:24:40 +01:00
Daniel Marjamäki 28c53cabea Fixed #2184 (False Positive: memory leak) 2010-11-10 17:46:40 +01:00
Daniel Marjamäki 23d3fd3a5a Fixed #2147 (uninitialized variable: false negative for 'x += y;') 2010-10-31 08:47:13 +01:00
Daniel Marjamäki 27235f27ae Fixed #2129 (Invalid dereference after release report) 2010-10-26 17:49:48 +02:00
Daniel Marjamäki 41a06a21d9 using deallocated pointer: detect first problem reported in ticket #2090 2010-10-25 17:36:46 +02:00
Daniel Marjamäki eba827bc4b Fixed #2112 (Crash scanning qtcreator sources) 2010-10-21 19:42:09 +02:00
Daniel Marjamäki 68dd2f8378 Fixed #2113 (False positive: Memory leak where a pointer is passed in a struct to another function to be freed) 2010-10-20 18:39:40 +02:00
Daniel Marjamäki 92a1e9e76e Severities: Added 'warning' and 'performance' severities. No changes to the command line options nor to the XML format. Ticket: #2106 2010-10-17 14:41:00 +02:00
Daniel Marjamäki 80069f016e Fixed #2065 (false positive: memory leak) 2010-09-27 17:53:10 +02:00
Pete Johns 6a52538a9a Fixed #1949: assert() hides memory leaks
Added separate unit-test (trac1949), initially broken to highlight the error and added "assert" to call_func_white_list.

Left TestMemleakInFunction::call_func() as is, as this wouldn't highlight the actual problem.
2010-09-27 20:25:34 +10:00
Daniel Marjamäki 78bd66cd5c Fixed #2056 (False positive: Resource leak) 2010-09-19 12:16:29 +02:00
Daniel Marjamäki 84d9282da2 Memory leaks: remove redundant 'if return ; else|' 2010-09-12 21:41:13 +02:00
Daniel Marjamäki 5a95303405 Memory leaks: reduce 'loop { if continue ;' to 'loop {' 2010-09-12 21:15:19 +02:00
Daniel Marjamäki 0a30aba2e6 Memory leaks: insert ';' in the simplifycode to split up the commands 2010-09-12 21:04:05 +02:00
Daniel Marjamäki 9c4a05a3bd Memory leaks: simplify 'loop { use ; callfunc ; }' to 'use ;' 2010-09-12 20:45:30 +02:00
Daniel Marjamäki ceeef847ef Memory leaks: simplify 'if break ; break ;' 2010-09-11 21:48:40 +02:00
Daniel Marjamäki 7aa0504692 Memory leaks: simplify 'use use' 2010-09-11 21:32:21 +02:00
Daniel Marjamäki 424fe064cb Memory leaks: don't write debug warning for '; alloc ; dealloc ; return ; }' 2010-09-11 21:14:20 +02:00
Daniel Marjamäki d4e045cee5 Memory leaks: fixed try/catch and nested loops simplifications 2010-09-11 21:07:35 +02:00
Daniel Marjamäki 4064712baa Memory leaks: improved simplification for 'callfunc' 2010-09-11 20:49:24 +02:00
Daniel Marjamäki 73122c3e8a Memory leaks: Improved the simplifycode for 'use ; if| use ;' 2010-09-11 20:18:16 +02:00
Daniel Marjamäki ecd863700e Fixed #2023 (false positive with realloc()) 2010-09-11 11:15:04 +02:00
Daniel Marjamäki 80be31de13 Fixed #2037 (memleak not detected in exit path when variable used) 2010-09-08 20:03:22 +02:00
Daniel Marjamäki 8e746ca53f CheckMemoryleaks: reduce 'use ; if return ; dealloc ;' to 'if return ; dealloc ;'. ticket: #2037 2010-09-08 19:22:03 +02:00
Daniel Marjamäki beb4dddb2e Refactoring CheckMemoryLeaks 2010-09-04 10:06:34 +02:00
Daniel Marjamäki fb4fce466e Fixed #2014 (False positive with longjmp) 2010-09-03 07:18:01 +02:00
Daniel Marjamäki d45186d645 Added --debug-warnings that we can use to enable various debug warnings 2010-08-27 20:28:00 +02:00
Daniel Marjamäki ca407110dc Fixed #1936 (Internal error. Token::Match called with varid 0.) 2010-08-24 20:58:22 +02:00
Daniel Marjamäki 225114df1c Fixed #1960 (cppcheck hangs with 100% cpu load) 2010-08-24 20:50:04 +02:00
Daniel Marjamäki 12217461a2 gcc: fixed some more -Wsign-conversion warnings 2010-08-06 22:37:48 +02:00
Daniel Marjamäki 7fb44d1995 gcc: fixed some compiler warnings when using -Wsign-conversion 2010-08-06 18:32:31 +02:00
Daniel Marjamäki f5823f7747 Visual Studio: Fixed warnings 2010-08-06 17:32:16 +02:00
Daniel Marjamäki eedb5e383e Memory leaks: better handling of 'return strcmp(..' etc 2010-08-05 21:23:32 +02:00
Daniel Marjamäki 9d24c9ceaa Memory leaks: refactoring return handling 2010-08-04 23:01:32 +02:00
Daniel Marjamäki 6d94c4f15e Memory leaks: don't translate 'return p[10];' to 'return use ;' 2010-08-04 20:48:20 +02:00
Daniel Marjamäki 6700351ede Fixed #1833 (memory leak detected in version 1.37 not detected in 1.43) 2010-08-02 23:04:23 +02:00
Daniel Marjamäki ff9d3d0965 memory leaks: better handling of 'loop { dealloc ; alloc ; }' 2010-08-02 22:17:09 +02:00
Daniel Marjamäki ae0252dc91 memory leaks: simplify 'callfunc ; ;' 2010-08-02 21:59:47 +02:00
Daniel Marjamäki df44703ee9 memory leaks: better checking of function calls. If there are statements after the function call it is unlikely the function call is noreturn 2010-08-02 21:56:50 +02:00
Daniel Marjamäki 694325d51f Fixed #1912 (False positive: memory leak (calling noreturn function)) 2010-07-30 08:50:10 +02:00
Zachary Blair 9f44d9eb62 Fixed #1889 (false positive: Common realloc mistake) 2010-07-26 23:17:27 -07:00
Daniel Marjamäki 5c771adece Refactoring: Use Check::reportError instead of writing to std::cout. Ticket: #1839 2010-07-23 22:53:29 +02:00
Daniel Marjamäki 3c376047ba pulled changes from kimmov (filelocation-refactor) 2010-07-19 18:06:49 +02:00
Zachary Blair 9ffd06ff5e Fixed #1856 (false positive: "pData" nulled but not freed upon failure) 2010-07-18 23:55:39 -07:00
Kimmo Varis 6db365e6f7 Improve path name handling in ErrorLogger.
This commit adds setfile() method to FileLocation class. The setfile
method converts in Windows path separators to internally used Unix
separators. And getfile() converts path separators back to Windows
separators. This fixes bugs that error reports had mixed path
separators in paths.
2010-07-17 01:27:40 +03:00
Kimmo Varis ad0394939a Refactor ErrorMessage constructor to take Severity::SeverityType.
This removes lots of unneeded casting as everybody now uses the
Severity::SeverityType.
2010-07-14 23:11:32 +03:00
Kimmo Varis 05adb285c5 Rename Severity::stringify() to Severity::toString(). 2010-07-14 17:40:18 +03:00
Kimmo Varis 3716b3f9d8 Rename Severity::e to Severity::SeverityType. 2010-07-14 17:30:03 +03:00
Daniel Marjamäki 49626e427e Realloc: changed the error message. I think it's better to mention realloc in the message. 2010-07-07 20:28:15 +02:00
Daniel Marjamäki dc2a0a6468 Fixed #1789 (false positive: memory leak (reallocation in subfunction through parameter)) 2010-07-06 21:36:50 +02:00
Daniel Marjamäki ae3557fa92 Fixed #1820 (False positive: memory leak (auto deallocated class)) 2010-07-05 14:01:25 +02:00
Daniel Marjamäki 3205775eb9 Fixed #1790 (mismatching allocation/deallocation false positive) 2010-06-30 09:21:15 +02:00
Daniel Marjamäki d22da6088c Fixed #1800 (false positive: memory leak when ptr used as map key) 2010-06-21 18:43:28 +02:00
Leandro Lisboa Penz 58a872e6a0 Fixed #1789 (false positive: memory leak (reallocation in subfunction through parameter))
Detecting reallocations in the other function.
2010-06-16 22:29:55 -03:00
Daniel Marjamäki 8a6f4254e0 Fixed #853 (False positive: memory leak for member variable with unknown function) 2010-06-16 19:28:47 +02:00
Daniel Marjamäki e987d2e05b Memory leaks: more specific bailouts to reduce false negatives 2010-06-13 19:00:11 +02:00
Daniel Marjamäki 76221c0916 Fixed #1510 (false positive '(possible error) Memory leak' when 'a = b = new ...; delete a' (but not b)) 2010-06-12 13:37:44 +02:00
Daniel Marjamäki e140ff6e84 Memory leaks: skipping function call inside allocation 2010-06-06 11:22:59 +02:00
Daniel Marjamäki a9196e8710 Memory leaks: Added allocation function 'g_strdup_printf' 2010-06-06 11:09:19 +02:00
Daniel Marjamäki 1de6e94947 Code coverage: Removed unused code 2010-06-05 11:25:47 +02:00
Leandro Lisboa Penz 4ac7da7d51 Fixed #73 (memory leaks not found when calling a function that returns allocated memory through a parameter) 2010-06-04 20:58:50 -03:00
Daniel Marjamäki 45821b3871 Fixed #1719 (False negative: memory leak (fgets in condition)) 2010-05-31 18:20:34 +02:00
Daniel Marjamäki 9b1ed1112b Memory leaks: Fixed bug in CheckMemoryLeak::functionReturnType 2010-05-30 20:30:08 +02:00
Daniel Marjamäki 0c6352a826 Memory leaks: small fixes. add checking of 'g_fopen'. don't let 'fclose' calls be interpreted as 'callfunc' 2010-05-29 21:56:18 +02:00
Daniel Marjamäki 495dfde32c Fixed #1716 (Wrong reporting of leak with close() in a while loop condition) 2010-05-29 21:11:59 +02:00
Daniel Marjamäki 24703418bd Fixed #1715 (switch with fallthrough and 'return' confuses cppcheck) 2010-05-29 20:55:09 +02:00
Daniel Marjamäki b702b8542d Memory leaks: enabled the leaks checking when members are not deallocated in the destructor. This checking was previously an --all check so there could be false positives. 2010-05-29 19:29:59 +02:00
Daniel Marjamäki 5692e7a6f6 Fixed #1707 (false positive: Memory leak) 2010-05-24 19:28:27 +02:00
Daniel Marjamäki 1792395654 astyle formatting 2010-05-18 20:08:27 +02:00
Zachary Blair 1539c0b3d2 Fixed #1649 (add a warning for potential memory leaks when using realloc) 2010-05-17 22:46:48 -07:00
Daniel Marjamäki d0e122079f Refactoring: Removed possibleError messages from CheckMemoryLeaks 2010-05-16 19:55:16 +02:00
Daniel Marjamki d7b117402c Code cleanup: Removed autodealloc handling 2010-05-16 07:15:31 +02:00
Daniel Marjamki 70d20ac544 Fixed #1681 (false negative: memory leak in operator =) 2010-05-15 19:40:32 +02:00
Daniel Marjamäki 5d01047ae4 Fixed #1665 ('If you see this, there is a bug': Token::Match('%var% ( %varid% [,)]', 0)) 2010-05-10 18:11:02 +02:00
Daniel Marjamäki d7118c4d36 Fixed #1648 (mismatch allocate and deallocate calls.) 2010-05-09 13:46:13 +02:00
Daniel Marjamäki d3b5c30c6c Fixed #1628 (false negative: memory leak when using redundant braces) 2010-04-27 20:43:31 +02:00
Daniel Marjamäki eb82a89758 ExecutionPath: Better handling of if 2010-04-25 11:55:57 +02:00
Daniel Marjamäki e068979d62 Fixed #1440 (false negative: memory leak (function parameters)) 2010-04-24 22:24:03 +02:00
Daniel Marjamäki 5e5b8d3861 Fixed #1146 (improve check: memory leak not detected (allocation in subfunction)) 2010-04-24 20:40:57 +02:00
Reijo Tomperi 35d2a27b9c Update copyright year in all source files 2010-04-13 22:23:17 +03:00
Daniel Marjamäki e9b4ea44a2 Refactoring: Disable inconclusive checks. They can still be activated for debugging/testing purposes 2010-04-10 14:05:33 +02:00
Reijo Tomperi fcf532ccaf Fix some -Wshadow compile warnings 2010-04-06 23:17:23 +03:00
Daniel Marjamäki cd2f8f6838 Merge branch 'master' of git://github.com/czw/cppcheck 2010-04-06 22:12:11 +02:00
Reijo Tomperi 5aa88ee5a2 Fix vs warnings. Apply patch from kidkat. 2010-04-06 21:35:21 +03:00
Jens Bäckman 9ae714661b Fix a rare crash with oddly formatted source files 2010-04-06 14:23:17 +02:00
Daniel Marjamäki b62ac149b5 Cleanup: Removed unused code from CheckMemoryLeak 2010-04-05 18:37:46 +02:00
Daniel Marjamäki abceff497b Refactoring: some refactoring of ExecutionPath. The foundError was removed. No automatic bailout of all checks are made when errors are found. 2010-04-04 11:24:52 +02:00
Daniel Marjamäki a8f566bfcd Cleanup: Removed redundant simplification in checkmemoryleak.cpp 2010-04-03 20:47:38 +02:00
Daniel Marjamäki 0cad22314e Reverted 'astyle fix'. Those changes are not in sync with my astyle configuration/setup. 2010-04-02 07:30:58 +02:00
Martin Ettl 193aa7d1d3 astyle fix 2010-04-02 02:21:53 +02:00
Daniel Marjamäki 3d90559035 Fixed #1386 and #1387 (False positives given by CheckMemoryLeakInFunction when temporary and member variable don't have the same allocation and deallocation) 2010-03-20 07:50:52 +01:00
Daniel Marjamäki 54c5d53eac Fixed #1428 (False positive: (possible error) Memory leak when memory deleted in destructor) 2010-03-19 16:57:23 +01:00
Daniel Marjamäki 30d3418b11 doxygen: added more comments for CheckNullPointer and CheckUninitVar 2010-03-13 21:42:59 +01:00
Daniel Marjamäki 65ae37de2f Fixed #1460 (false positive: memory leak when using throw no_memory) 2010-03-13 17:11:48 +01:00
Daniel Marjamäki a6c9a6fc54 Fixed #1407 (false positive memory leak when returning pointer to the allocated memory) 2010-02-20 10:17:45 +01:00
Daniel Marjamäki 57f63f65c2 Borland C++: Fixed compiler errors (operands must be same type) 2010-02-20 08:53:33 +01:00
Daniel Marjamäki 9394816fcf Refactoring: Use std::string instead of const char * 2010-02-14 19:58:17 +01:00
Daniel Marjamäki e1b54df368 Fixed #1346 (False positive: Memory leak when allocated memory is stored elsewhere inside a condition) 2010-02-06 22:35:36 +01:00
Daniel Marjamäki 71117378ef Fixed #1363 (false positive: memory leak) 2010-02-06 21:47:52 +01:00
Monika Lukow 25822dff24 Fixed #1249 (false positive '(error) Resource leak: f' for 'popen' / 'if(pclose(f) < 0)' sequence) 2010-01-31 11:44:30 +01:00
Reijo Tomperi 1d5ba4e320 Improved updateClassList(), but not yet took it into use.
findClassFunction is now non-static.
updateClassList usage is currently commented out as it doesn't handle class inside a function
2010-01-29 23:22:18 +02:00
Daniel Marjamäki 9d11492845 Fixed #1286 (Memory leak not detected) 2010-01-27 22:05:04 +01:00
Daniel Marjamäki e49f7bfa0e Fixed #1315 (mismatched allocation and deallocaton not detected) 2010-01-27 21:02:13 +01:00
Daniel Marjamäki fa305d70bc Fixed #1302 (False positive: Confusion between POSIX open() and class member) 2010-01-26 20:10:52 +01:00
Daniel Marjamäki 724c55b32a Memory leaks: some refactorings and minor improvements 2010-01-24 21:48:39 +01:00
Daniel Marjamäki a6e81c2ee7 Fixed #1293 (Things to add to call_func_white_list) 2010-01-20 22:03:06 +01:00
Daniel Marjamäki 85fcd4c9a9 Fixed #1282 (False positive for a memory leak in a simple loop) 2010-01-19 19:08:03 +01:00
Daniel Marjamäki f49cc7f0ff CheckMemoryLeak: Added 'scanf' and 'sscanf' to the whitelist 2010-01-18 21:58:27 +01:00
Daniel Marjamäki 32604dd55e Fixed #1266 ('qsort' missing in call_func_white_list) 2010-01-18 21:34:11 +01:00
Daniel Marjamäki ac077d3160 Fixed #1264 (False positive: Resource leak with if-else in while) 2010-01-14 21:41:50 +01:00
Daniel Marjamäki 0638bc2112 CheckMemoryLeaks: Added 'strlen' to white list 2010-01-12 22:10:59 +01:00
Daniel Marjamäki fd5e3e63b8 Fixed #1258 ('fscanf' missing in call_func_white_list) 2010-01-12 21:56:22 +01:00
Daniel Marjamäki 814eb6caee Fixed #1257 (potential leaks not reported becauseof 'continue' in loop) 2010-01-12 19:12:08 +01:00
Daniel Marjamäki 3fb420cbf0 fixed unlogged errors from the tokenizer and also some errors reported by valgrind 2010-01-10 20:03:46 +01:00
Daniel Marjamäki a50ec2eded memory leaks: better handling of loops and switch 2010-01-10 15:40:50 +01:00
Daniel Marjamäki f65bf6d565 Fixed #1220 (False memory leak when using while) 2010-01-10 14:00:32 +01:00
Daniel Marjamäki 3fabe53570 Memory leaks: Better handling of switch 2010-01-10 10:37:54 +01:00
Daniel Marjamäki 686137415f Fixed #1235 (CheckMemoryLeakInFunction: Wrong handling of 'fcloseall') 2010-01-07 21:36:51 +01:00
Daniel Marjamäki 57d1da3910 Ticket #1228 : Handle tokensBack in the Token class. When adding&removing tokens the Token class can make sure that this pointer is updated accordingly. It is very important that the tokensBack has the same scope as the token list, otherwise there will be a dead pointer problem. 2010-01-06 20:19:27 +01:00
Daniel Marjamäki 6c0919d9bd Fixed #1173 (Improve check: memory leak not detected in constructor) 2009-12-30 21:29:54 +01:00
Daniel Marjamäki 7bf0622ae0 ExecutionPath: Refactoring the interface 2009-12-25 20:12:06 +01:00
Daniel Marjamäki d2dc5806cd Borland C++: Fixed compiler error 2009-12-22 23:21:52 +01:00
Daniel Marjamäki cd2e501794 Visual Studio: Fixed unittests 2009-12-22 21:56:00 +01:00
Daniel Marjamäki b4b63789fc Eric Sesterhenn: Fixed #1131 (descriptor leak false positive) 2009-12-22 19:13:46 +01:00
Daniel Marjamäki 763e3d9eb5 Execution Path: Refactoring 2009-12-21 18:17:35 +01:00
Daniel Marjamäki 368df4c083 TestLocalLeaks: going out of scope 2009-12-15 19:27:07 +01:00
Reijo Tomperi 64261e6909 Fix compiler error: cast from 'CheckLocalLeaks*' to 'int' loses precision 2009-12-15 00:57:32 +02:00
Daniel Marjamäki 0c13f9ba5c Added TestLocalLeaks 2009-12-14 20:30:31 +01:00
Daniel Marjamäki 4dc8794c69 Fixed #1082 (False positive: Resource leak in loop which exits only after releasing resource) 2009-12-13 19:50:49 +01:00
Reijo Tomperi 2b980f9abe astyle fix 2009-12-03 22:48:52 +02:00
Daniel Marjamäki 48bb1fdc83 Eric Sesterhenn: Fixed #1032 (False positive resource leak with exit at end of function) 2009-12-03 19:19:20 +01:00
Daniel Marjamäki 42ffea4f16 Fixed #968 (False positive when TEMP_FAILURE_RETRY used) 2009-11-18 17:17:37 +01:00
Daniel Marjamäki b5cbc509f3 Fixed #483 (False positive: found leak when foreach for lists used) 2009-11-15 10:30:00 +01:00
Daniel Marjamäki 14fd0154d2 memory leaks: simple code cleanup 2009-11-15 09:53:38 +01:00
Daniel Marjamäki fee96f3cd6 Fixed #944 (new false positives against Wine Git Tree) 2009-11-14 09:06:28 +01:00
Daniel Marjamäki 1187587521 Fixed #919 (possible memory leak not detected) 2009-11-13 20:22:28 +01:00
Daniel Marjamäki 2a6cde4369 Fixed #905 (memory leak not detected when using puts) 2009-11-07 07:21:39 +01:00
Daniel Marjamäki 0682db47a7 Memory leaks: Detect simple leak 2009-10-27 23:08:11 +01:00
Daniel Marjamäki 45b0758e71 Fixed #860 (Improve double delete detection) 2009-10-27 21:28:03 +01:00
Daniel Marjamäki 09859c1019 refactoring the folder structure 2009-10-25 12:49:06 +01:00