Commit Graph

587 Commits

Author SHA1 Message Date
Pete Johns 098f0bf3e6 Fixed #2526 (Make TODO_ASSERT_EQUALS take three arguments (value, to_be, as_is)?...
Removed replaced EXPECTED with...

WANTED (to-be):     The future expected value.
CURRENT (as-is):    Documenting how cppcheck behaves now.

This removes the need for an ASSERT_EQUALS but enforces the check for every TODO_ASSERT_EQUALS.
2011-01-30 23:20:11 +11:00
Robert Reif 09998d9e18 Memory leaks: less conservative checking of classes. ticket: #2517 2011-01-30 08:38:20 +01:00
Daniel Marjamäki f947955c63 Fixed #2492 (False positive: memory leak 'return &self->foo;') 2011-01-22 13:40:19 +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
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
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 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 7050e9610b checkmemoryleaks: added assertion for todo assertion 2010-12-17 21:30:02 +01:00
Daniel Marjamäki 49ee1533d9 Fixed #2301 (false positive: The given size 3 is mismatching) 2010-12-16 21:27:33 +01:00
Daniel Marjamäki 3918aa4953 memory leaks: fixed test that I broke in my last commit 2010-12-09 06:13:59 +01:00
Daniel Marjamäki cad9c5f232 Fixed #2285 (False Positive: memory leak) 2010-12-08 21:02:02 +01:00
Robert Reif 399cc63d2d Symbol database: adds new tests that verify that namespaces work for the class check 2010-12-07 07:08:05 +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
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
Robert Reif f12c0c7ada Tokenizer: add assert(_settings) to Tokenizer to insure the tokenizer always has settings. Ticket: #2219 2010-12-01 18:00:55 +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 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 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 5ef02b6c0a memleak: activated todo test case. ticket: #1401 2010-10-21 22:33:40 +02:00
Daniel Marjamäki eba827bc4b Fixed #2112 (Crash scanning qtcreator sources) 2010-10-21 19:42:09 +02:00
Daniel Marjamäki 8b866178ff Fixed #2103 (false positive when variable is checked to NULL and not freed) 2010-10-20 20:38:37 +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 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 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 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 eedb5e383e Memory leaks: better handling of 'return strcmp(..' etc 2010-08-05 21:23:32 +02:00
Daniel Marjamäki e5a2c6426b Memory leaks: Added ASSERT_EQUALS near the TODO_ASSERT_EQUALS 2010-08-05 13:30:07 +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
Zachary Blair 9ffd06ff5e Fixed #1856 (false positive: "pData" nulled but not freed upon failure) 2010-07-18 23:55:39 -07:00
Martin Ettl 5ab36d8a6d added a testcase for ticket #1879 2010-07-18 15:13:48 +02: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 ad4681223b Ticket #1789 is not really fixed; added TODO. 2010-06-16 22:47:05 -03:00
Leandro Lisboa Penz 350810e3c1 Improved test of pointer argument realloc. 2010-06-16 22:46:47 -03: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 37ade20dad Added testcase for #1557 (false positive: memory leak) 2010-06-13 10:43:23 +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 3a4a151cc4 reverted 'added a todo testcase for ticket #1788' 2010-06-12 08:36:10 +02:00
Martin Ettl 69ecc24bf5 added a few testcases for checking memory leaks in classes 2010-06-11 13:33:10 +02:00
Martin Ettl 81828742ac added a todo testcase for ticket #1788 2010-06-11 13:23:10 +02:00
Martin Ettl be9c23cb1a added todo-testcase for ticket #1401 2010-06-10 22:49:34 +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
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
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 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 b11fc0a069 Fix one compiler warning 2010-04-18 22:14:25 +03:00
Daniel Marjamäki c0e9a546f7 Refactoring: Refactoring the Settings class 2010-04-17 09:23:54 +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 6dc3860ae9 Fix more -Wshadow compile warnings 2010-04-09 22:40:37 +03: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 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 2441a79c7b unit testing: use const_cast instead of defines 2010-03-17 21:58:53 +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 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
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 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 6c0919d9bd Fixed #1173 (Improve check: memory leak not detected in constructor) 2009-12-30 21:29:54 +01:00
Daniel Marjamäki afad0205c4 Fixed #1120 (Test compile warnings with Cygwin) 2009-12-26 17:49:05 +01:00
Daniel Marjamäki aaf908bd5e astyle formatting 2009-12-22 19:18:02 +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 11c7b8a839 Execution Path: some refactorings of the checking 2009-12-20 19:44:32 +01:00
Daniel Marjamäki 368df4c083 TestLocalLeaks: going out of scope 2009-12-15 19:27:07 +01: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
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 153a13272c ericsesterhenn: Fix #1028 (False positive resource leak) 2009-11-30 16:45:19 +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 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
Daniel Marjamäki 26a81e82cc Fixed #253 (MemoryLeakInClass: False positive when memory is released in function, which is called from destructor) 2009-10-24 15:07:14 +02:00
Daniel Marjamäki 2c8a418c7e Memory leaks: Added and fixed testcase TestMemleakInClass::class13 2009-10-23 20:04:47 +02:00
Daniel Marjamäki 701d622ff0 Fixed #428 (Memory leak not detected with class) 2009-10-22 21:51:58 +02:00
Daniel Marjamäki 58790eda82 Fixed #449 (false postive:: resource leak when using errno) 2009-10-18 13:17:05 +02:00
Daniel Marjamäki ed3860a0a7 Fixed #805 (False positive: Member functions not handled correctly) 2009-10-12 21:36:28 +02:00
Reijo Tomperi ab762b1a00 Fix #388 (resource leak not detected, allocation through function call)
http://sourceforge.net/apps/trac/cppcheck/ticket/388
2009-10-06 23:14:32 +03:00
Daniel Marjamäki 36fb24b1a5 memory leaks: don't write errors for static member variables 2009-10-06 18:25:00 +02:00
Daniel Marjamäki 23d8937661 Fixed #789 (false positive: resource leak reported when using for loop) 2009-10-04 19:58:41 +02:00
Daniel Marjamäki 6b1fae75e5 Fixed #785 (False positive: resource leak of extern FILE*) 2009-10-04 14:24:41 +02:00
Daniel Marjamäki af5a695f82 Fixed #727 (False positive: Resource leak when release is done inside function call) 2009-10-04 13:10:08 +02:00
Daniel Marjamäki 4387071eb1 Fixed #733 (New check: locking & unlocking mutex and semaphore variables) 2009-10-03 21:46:22 +02:00
Daniel Marjamäki 57067f6627 memory leaks: refactoring unit tests 2009-10-01 22:25:59 +02:00
Reijo Tomperi b3ad712b61 Fix #421 (Memory leak not found when typeid() is used.)
http://sourceforge.net/apps/trac/cppcheck/ticket/421
2009-10-01 11:56:59 +03:00
Daniel Marjamäki e3e8224b4e memory leaks: fixed TODO_ASSERT_EQUALS 2009-09-30 22:27:00 +02:00
Reijo Tomperi f9871c2d54 Fix #745 (false positive: possible null pointer dereference , while)
http://sourceforge.net/apps/trac/cppcheck/ticket/745
2009-09-30 21:42:14 +03:00
Daniel Marjamäki 311f6dc92e Fixed #746 (False positive, Memory leak when goto is used) 2009-09-28 22:58:06 +02:00
Daniel Marjamäki 1427f0a2c7 memory leaks: fixed a TODO_ASSERT_EQUALS for a false positive 2009-09-28 22:41:45 +02:00
Daniel Marjamäki a61abcbbc8 Fixed #728 (False positive, resource leak, when released in a loop) 2009-09-27 21:49:07 +02:00
Reijo Tomperi fdde2182b9 Fix GPL comments in all files. ">." was missing from the end. 2009-09-27 18:08:31 +03:00
Daniel Marjamäki 482a2f9d95 Fixed #718 (False positive, resource leak when break in a loop before exit) 2009-09-26 07:19:22 +02:00
Daniel Marjamäki 6db95cd01c Memory leaks: Added a TODO assertion for a false positive 2009-09-25 22:01:54 +02:00
Daniel Marjamäki cd94d50526 Memory leaks: fixed a TODO_ASSERT_EQUALS 2009-09-24 22:40:18 +02:00
Daniel Marjamäki fa4e0a617e Fixed #700 (False positive: Memory leak) 2009-09-23 22:42:07 +02:00
Daniel Marjamäki ad92aa4c20 Fixed #715 (False positive: Resource leak when exit() after if loop) 2009-09-22 18:09:29 +02:00
Reijo Tomperi 661e4504cb astyle fix 2009-09-19 14:21:50 +03:00
Daniel Marjamäki 8f96c1992a Fixed #688 (False positive in error category when --all is used) 2009-09-19 08:23:10 +02:00
Daniel Marjamäki 5efedf85d6 Fixed #671 (False positive. Leak when loop is before exit) 2009-09-15 22:26:38 +02:00
Daniel Marjamäki 1d974f7c05 memory leaks: added test assertion. simplify ';alloc;exit;' to ';exit;' 2009-09-13 07:20:42 +02:00
Daniel Marjamäki 5df28c51c6 memory leaks: minor refactorings 2009-09-12 21:13:47 +02:00
Daniel Marjamäki ab4a7fdef2 Fixed #518 (False positive for leaks when function from err()-family used) 2009-09-12 14:11:17 +02:00
Daniel Marjamäki 333c6d9e0a memory leaks: Added a todo test case for the getcode function 2009-09-04 19:11:19 +02:00
Daniel Marjamäki 93659bbe08 memory leaks: fixed a todo testcase to find more leaks 2009-09-01 20:12:53 +02:00
Daniel Marjamäki 9a47b7110e memory leaks: fixed todo testcases to find more memory leaks 2009-09-01 20:02:28 +02:00
Slava Semushin 0ec848b1fa test/testmemleak.cpp(dofindleak): provide settings object with debug enabled.
This allows to print tokens when syntax error found in one of tests.
2009-09-02 00:38:35 +07:00
Daniel Marjamäki 7ba244cf45 Memory leaks: fixed a todo testcase 2009-09-01 19:33:17 +02:00
Daniel Marjamäki 59a4a36fe1 memory leaks: minor fix for testcase 2009-09-01 19:06:34 +02:00
Reijo Tomperi 67a8a3225c astyle fix 2009-08-30 23:07:37 +03:00
Daniel Marjamäki 960fb861da Refactoring: Refactoring of the unit testing for the CheckMemoryLeakInFunction 2009-08-30 21:11:15 +02:00
Daniel Marjamäki 9d7defad22 Fixed #615 (Memleak was detected in 1.32 but not in 1.33 and later) 2009-08-29 17:33:57 +02:00
Daniel Marjamäki 1dd2ec4757 Fixed #414 (memory leak in if-else construct not detected) 2009-08-29 16:55:43 +02:00
Daniel Marjamäki 270d2b2d4f memory leaks: improved the simplification of 'if* ;' 2009-08-29 16:27:16 +02:00
Daniel Marjamäki 8f1f89ae2b memory leaks: fixed todo test case. reduce exit better 2009-08-29 16:03:23 +02:00
Daniel Marjamäki 6347d0e976 memory leaks: better handling of open/close 2009-08-29 09:18:21 +02:00
Daniel Marjamäki 88d0bd3908 astyle 2009-08-29 08:20:18 +02:00
Daniel Marjamäki ee5b2a43c7 Fixed #627 (False positive with --all, Resource leak with open()) 2009-08-29 07:43:44 +02:00
Daniel Marjamäki de9e62e90a Memory leaks: handling asprintf better 2009-08-29 07:26:32 +02:00
Daniel Marjamäki 406fdd3219 Memory leaks: Fixed two todo testcases (getcode handling of asprintf) 2009-08-29 07:02:36 +02:00
Daniel Marjamäki ab047c680c memory leaks: fixed a todo testcase 2009-08-29 06:42:24 +02:00
Daniel Marjamäki 74fd052fc0 Memory leaks: Testing that asprintf is handled correctly 2009-08-28 23:26:40 +02:00
Reijo Tomperi e3c1e14bb0 astyle fix 2009-08-26 00:41:03 +03:00
Daniel Marjamäki d67e3fcc49 Refactoring the unit tests of TestMemleakInFunction 2009-08-25 22:18:22 +02:00
Daniel Marjamäki c25e1963b1 Fixed #498 (Tokenizer: simplify 'goto') 2009-08-24 23:10:12 +02:00
Daniel Marjamäki 9da2ecf4f4 Refactoring the unit testing. Wrote special tests for CheckMemoryLeakInFunction::findleak 2009-08-23 15:48:25 +02:00
Daniel Marjamäki 0da25081d5 refactoring: began refactoring the unit testing for CheckMemoryLeakInFunction. More specific testing of the functions getcode, simplifycode, call_func, etc 2009-08-23 11:26:17 +02:00
Daniel Marjamäki 8b46172bcf Memory leaks: Use varid instead of varname 2009-08-19 19:42:07 +02:00
Daniel Marjamäki 85682ed429 Fixed #591 (False positive: Deallocating a deallocated pointer) 2009-08-18 20:49:08 +02:00
danmar 3de825c290 Borland C++ Builder: Fixed compilation and testrunner problems 2009-08-13 22:13:52 +02:00
Daniel Marjamäki ecdbcbce3d Fixed #566 (False positive when assigning the return value of realloc(NULL,..) to a pointer variable holding a freed memory address) 2009-08-10 22:04:28 +02:00
Daniel Marjamäki ce8c5b0236 Fixed #555 (False positive: [CuTest.c:25]: (error) Memory leak: len) 2009-08-05 21:18:16 +02:00
Daniel Marjamäki 9e348ca739 Fixed #554 (resource leak false positive) 2009-08-04 21:34:14 +02:00
Daniel Marjamäki 706ba34a6d Refactoring the unit testing 2009-08-04 21:32:14 +02:00
Reijo Tomperi 769119c725 Fix ticket #552 (False positive with --all when realloc is used with two variables.)
http://sourceforge.net/apps/trac/cppcheck/ticket/552
2009-08-02 23:30:43 +03:00
Reijo Tomperi 10f6678cf9 TODO test case realloc5 added and "Checkmemoryleak: simplifycode result for" debug info added. 2009-08-02 22:23:47 +03:00
Daniel Marjamäki b7ffcf53ba Fixed #511 (false positive, memory leak when using 'var = ({});') 2009-07-31 23:42:21 +02:00
Daniel Marjamäki 050b85c5eb memory leak for struct member: fixed false positive when the struct pointer is stored away 2009-07-29 11:38:20 +02:00
Daniel Marjamäki 6bb85703f6 memory leaks: fixed false positive for struct members - better handling of if/else 2009-07-24 09:05:40 +02:00
Daniel Marjamäki 73c028bdb7 memory leaks: added a todo test case for struct members when using if-else 2009-07-23 22:29:31 +02:00
Daniel Marjamäki 565ac2fca6 Fixed #493 (Memory leak: False positive when using the exit(0)) 2009-07-23 16:30:30 +02:00
Daniel Marjamäki 3243933c90 Fixed #494 (False positives of checking leaks struct members)
Better handling of function calls
2009-07-22 08:30:51 +02:00
Daniel Marjamäki 6f646246ee dereferencing deallocated memory: it is ok to take the address to deallocated memory but it is not ok to dereference the address 2009-07-21 13:04:13 +02:00
Daniel Marjamäki 74699cab66 memory leak for struct member: made the checking more sensitive. Skip bail-out execution paths were the member is properly deallocated 2009-07-20 14:39:24 +02:00
Daniel Marjamäki ddaea3244d memleak: implemented simple checking for leaking struct members 2009-07-19 16:51:31 +02:00
Daniel Marjamäki ffac9281c4 astyle formatting 2009-07-18 20:35:22 +02:00
Slava Semushin 2ba0897ecb src/checkmemoryleak.cpp: added fchmod() function to white list. 2009-07-18 23:48:48 +07:00
Slava Semushin a0a526a205 Fixed ticket #464 (resource leak not detected when getc is used on the file handle)
http://sourceforge.net/apps/trac/cppcheck/ticket/464
2009-07-18 18:32:55 +07:00
Daniel Marjamäki 7d35447d80 refactoring: renamed the severity "all" to "possible error" 2009-07-13 10:16:31 +02:00
Daniel Marjamäki 2a02041fd8 memleak: fixed todo test case 2009-07-07 15:22:37 +02:00
Daniel Marjamäki 7b2f6b6173 addon to previous commit - changed ASSERT_EQUALS to TODO_ASSERT_EQUALS for the todo test case 2009-07-06 12:38:04 +02:00
Daniel Marjamäki 5efb834f36 Memory leaks: Added a simple todo test case 2009-07-06 12:33:31 +02:00
Daniel Marjamäki 9beb73824b Fixed #446 (memory leak false positive when variable is static) 2009-07-06 12:20:13 +02:00
Reijo Tomperi f676deb208 Test case improvement, unused function removed from tokenizer. 2009-07-05 22:37:53 +03:00
Daniel Marjamäki 13ca5f89be added test case 2009-06-23 18:29:43 +02:00
Slava Semushin 13e805f332 Fixed ticket #399 (Add detection for resource leaks after open() usage)
http://sourceforge.net/apps/trac/cppcheck/ticket/399
2009-06-21 22:01:43 +07:00
Daniel Marjamäki 8715ba1458 CheckMemoryLeakInFunction: More sensitive checking when the code calls an unknown function 2009-06-21 14:12:59 +02:00
Daniel Marjamäki f28dec1f5a detect memory leak when all is given when calling an unknown function 2009-06-21 13:48:39 +02:00
Daniel Marjamäki 453a5cdd47 Fixed ticket #411 (false positive: resource leak in while loop) 2009-06-20 13:58:30 +02:00
Daniel Marjamäki 5d0d21d668 Fixed a false positive (memory leak)
This false positive was first discovered in the VLC sourcecode. The TestMemoryLeakInFunction::simple11 test case is a simplified test code of that code.
2009-06-17 21:42:49 +02:00
Daniel Marjamäki b7c9a4ed8c Created a new class for detecting leaks (forgetting to free struct members) 2009-06-16 22:01:04 +02:00
Daniel Marjamäki ed98f1b367 Fixed #131 (Regression: leak reported by 1.27 is not reported by 1.29)
The leak will be reported as a definite bug again. Not just a possible bug.
cppcheck don't know if the execution path is possible, but it knows that if the execution path is taken the memory leak will be certain.
2009-06-16 19:05:05 +02:00
Daniel Marjamäki a81b6487bf Improved the "CheckMemoryLeak::functionReturnType" 2009-06-15 21:13:39 +02:00
Daniel Marjamäki 433ff048a4 Fixed #264 (Memory Leak: alloc by assigning to a return value)
The fix was inspired by the previous patch submitted by hoangtuansu
2009-06-15 17:44:59 +02:00
Slava Semushin 8c327f82b3 Fixed ticket #346 (adding a "const" token prevents detection of memory leak)
http://sourceforge.net/apps/trac/cppcheck/ticket/346
2009-06-15 00:32:34 +07:00
Slava Semushin 4dd3835617 Embed errout.str() into ASSERT_EQUALS() call.
Get rid of useless variables.

No functional change.
2009-06-14 13:33:44 +07:00
Daniel Marjamäki 777790ebc7 Fixed ticket #367 (Deallocating a deallocated pointer false positive when va_list used)
The overall matching of functions when calls are made were improved.
2009-06-12 17:31:29 +02:00
Daniel Marjamäki 2c07c22d9e Refactoring: Split up the CheckMemoryLeak into CheckMemoryLeakInFunction and CheckMemoryLeakInClass 2009-06-08 20:20:43 +02:00
Daniel Marjamäki 15dbf9c085 Refactoring: Renaming the CheckMemoryLeakClass to CheckMemoryLeak. Deleted testmemleakmp 2009-06-08 18:51:17 +02:00
Reijo Tomperi 9bac4aca75 Fix ticket #371 (Resource leak when exit() and if() uses together)
http://apps.sourceforge.net/trac/cppcheck/ticket/371
2009-06-07 09:55:20 +03:00
Daniel Marjamäki a8c5526c84 Fix #368 (Leak detected when allocated memory assigned to member of structure which returned from function)
The return value of strcpy wasn't handled very well
2009-06-06 20:55:16 +02:00
Daniel Marjamäki d0f3dccc6d Fixed #354 (false positive: memory leak) 2009-06-05 08:56:46 +02:00
Slava Semushin 21e0639443 Fixed ticket #360 (Teach about new(std::nothrow) form)
http://apps.sourceforge.net/trac/cppcheck/ticket/360
2009-06-05 11:03:48 +07:00
Slava Semushin 52a8368b02 Strip redundant std::string usage from tests.
Second round: handle empty strings.

Done by command:
git grep -l ASSERT_EQUALS | xargs sed -i 's|ASSERT_EQUALS(std::string(\(".*"\)),|ASSERT_EQUALS(\1,|'

Should be no functional change.
2009-06-05 07:43:55 +07:00
Reijo Tomperi 1bb7b01a06 Fix ticket #352 (Memory leaks: Missed memory leak when "--all" is not given)
http://apps.sourceforge.net/trac/cppcheck/ticket/352
Detect memory leaks without --all when there is "alloc ; assign callfunc ;
2009-06-03 23:20:33 +03:00
Slava Semushin 37a485f4f0 Fixed ticket #349 (Add detection for resource leaks after tmpfile() usage)
https://apps.sourceforge.net/trac/cppcheck/ticket/349
2009-06-01 17:40:24 +07:00
Slava Semushin e5c0383594 Strip redundant std::string usage from tests.
Done by command:
git grep -l ASSERT_EQUALS | xargs sed -i 's|ASSERT_EQUALS(std::string(\(".\+"\)),|ASSERT_EQUALS(\1,|'

Should be no functional change.
2009-06-01 02:50:25 +07:00
Daniel Marjamäki bf98ff85e5 Memory leaks: calling function that deallocates the memory and allocates new memory
https://apps.sourceforge.net/trac/cppcheck/ticket/336
2009-05-30 20:30:44 +02:00
Reijo Tomperi 58eda6e978 Fix ticket #325 (Replace developer names in source files with AUTHORS file)
http://apps.sourceforge.net/trac/cppcheck/ticket/325
2009-05-30 08:48:12 +03:00
Reijo Tomperi d6a34dafb2 Added test case TestMemleak::dealloc_and_alloc_in_func 2009-05-27 22:16:54 +03:00
Slava Semushin 2654a4aa54 Added support to search resource leaks after opendir()/fdopendir() usage. 2009-05-24 02:53:02 +07:00
Slava Semushin bfd49e21e7 Added 17 functions which work with FILE structure to white list.
Inspired by previous commit.
2009-05-23 18:01:18 +07:00
Slava Semushin b5c7316666 Fixed ticket #327 (File descriptor leak not detected when feof() used)
Thanks to aggro80@ for help.

http://apps.sourceforge.net/trac/cppcheck/ticket/327
2009-05-23 17:20:26 +07:00
Reijo Tomperi 0f9b2efa43 Fix ticket #326 (Reported memory leak when pointer returned by assign to function's parameter)
http://apps.sourceforge.net/trac/cppcheck/ticket/326
2009-05-22 23:36:03 +03:00
Slava Semushin a2a6eebb01 Fixed ticket #324 (Teach about fcloseall() function)
http://apps.sourceforge.net/trac/cppcheck/ticket/324
2009-05-22 21:47:40 +07:00
Reijo Tomperi e6017ad54b Fix #299 (Memory leak not detected when parameters contain ::)
http://apps.sourceforge.net/trac/cppcheck/ticket/299
2009-05-21 22:51:19 +03:00
Reijo Tomperi 9c60391375 Apply patch #320 from php-coderrr ([PATCH] Determine memory leaks after strndup() usage)
http://apps.sourceforge.net/trac/cppcheck/ticket/320
2009-05-19 23:29:10 +03:00
Reijo Tomperi 31f315d2ec Added TODO test case TestMemleak::stdstring 2009-05-12 22:04:49 +03:00
Daniel Marjamäki daea0547fa memory leaks: Handling exit (#297) 2009-05-10 08:01:38 +02:00
Daniel Marjamäki a32114b15c memleak: removed false positives for pclose (#286) 2009-05-06 21:31:31 +02:00
Reijo Tomperi 177aeba0cf Added TODO test case TestMemleak::assign_pclose 2009-05-06 21:20:25 +03:00
Reijo Tomperi a46de47158 Fix ticket #196 (False positive: Resource leak)
http://apps.sourceforge.net/trac/cppcheck/ticket/196
2009-05-01 14:39:57 +03:00
Reijo Tomperi 7002af6c9a astyle fix 2009-05-01 12:29:49 +03:00
Reijo Tomperi 34540fee04 Fix partially ticket #196 False positive: Resource leak
And add few test cases related to it. Move one failing test behind TODO
http://apps.sourceforge.net/trac/cppcheck/ticket/196
2009-05-01 12:28:33 +03:00
Reijo Tomperi a8f296bb6e Added test case TestMemleak::free_member_in_sub_func for ticket #253
http://apps.sourceforge.net/trac/cppcheck/ticket/253
2009-04-29 21:40:21 +03:00
Daniel Marjamäki bb154da394 memory leaks: handling std::auto_ptr (#266) 2009-04-28 20:01:35 +02:00
Leandro Lisboa Penz 82cb229871 checkmemoryleak: fixed and reactivated forwhile9 and forwhile10 tests. 2009-04-04 20:55:45 -03:00
Daniel Marjamäki 4c4f138639 Memory leaks: refactoring the TODO test cases 2009-03-28 20:50:09 +01:00
Nicolas Le Cam ad7df1cbe0 Add TestMemleak::realloc4 that currently fail.
Change TestMemleak::if10, TestMemleak::forwhile8 and TestMemleak::realloc2 as they are currently leaking memory, mark them as TODO.
Comment out TestMemleak::forwhile9 and TestMemleak::forwhile10 as they are wrong (infinite loops).
2009-03-28 16:21:55 +01:00
Daniel Marjamäki 7afccc395a testing: new handling of todo test cases. If they use TODO_ASSERT_EQUALS instead we can detect when they are fixed 2009-03-25 18:31:40 +01:00
Daniel Marjamäki 9f3634412e simplify tokens (known variable values in conditions) 2009-03-25 07:10:17 +01:00
Daniel Marjamäki 06776c6ac7 Fixed the testcase TestMemleak::realloc3 2009-03-23 18:34:59 +01:00
Daniel Marjamäki c9d02273b8 added todo test case for ticket 200 2009-03-22 21:42:01 +01:00
Daniel Marjamäki 9f1c3cc535 refactoring the rest of the classes 2009-03-20 18:16:21 +01:00
Reijo Tomperi 21b687b301 Improved tokenizer to handle '#' better. Previously everything after # was combined into a single token,
now # is considered more like an alphabet, with few exceptions, e.g. "##" tokens.
2009-03-15 23:09:27 +02:00
Daniel Marjamäki 75d0e8687b Memory leak: handle allocation in deallocation list 2009-03-14 20:19:36 +01:00
Daniel Marjamäki 02df14ec37 Memory leaks: Refactoring to use Tokenizer::FindClassFunction. Enabled test case, the memory leak is now detected 2009-03-14 18:21:37 +01:00
Daniel Marjamäki 0a6a0ae46e TestMemleak: added two testcases for checking for leaks in classes 2009-03-13 19:52:01 +01:00
Daniel Marjamäki cc8a6168e7 astyle formatting 2009-03-06 18:13:41 +01:00
Daniel Marjamäki d7cd09cb6e added internal support for handling list of classes that are automaticly deallocated 2009-03-06 07:22:07 +01:00
Reijo Tomperi 832275bc37 Fix #132 (False positive returning memcpy()) 2009-03-03 20:39:17 +00:00
Daniel Marjamäki 87b0314e72 memory leak: fixed issue with reporting wrong location 2009-03-01 20:34:04 +00:00
Reijo Tomperi fc8f47145a Copyrights updated 2009-03-01 19:52:33 +00:00
Daniel Marjamäki 35583293ec memory leak: Fixed a false positive when all is given 2009-02-25 19:20:23 +00:00
Daniel Marjamäki d15aea1b0c memory leak: fixed false positive when using 'return strcpy' 2009-02-24 06:23:21 +00:00
Daniel Marjamäki 44a5cecd99 memory leaks: improved handling of --vcl 2009-02-23 19:32:54 +00:00
Daniel Marjamäki 385be6d0d9 memory leak: Added command line flag '--vcl' that is used to suppress error messages for VCL code 2009-02-20 06:28:18 +00:00
Daniel Marjamäki 5c1995ca81 memory leak: handle 'delete (p)' and 'delete [] (p)'. Fixes ticket 102 2009-02-14 06:54:23 +00:00
Daniel Marjamäki a5f88862b4 memory leak: keep track of --all better 2009-02-09 20:16:00 +00:00
Daniel Marjamäki e572cb3c1d Memory leak: Test code was supposed to call unknown function 2009-02-08 18:50:34 +00:00
Daniel Marjamäki 1637e867de mismatching allocation size: moved to error suite 2009-02-08 18:34:04 +00:00