Commit Graph

147 Commits

Author SHA1 Message Date
Reijo Tomperi bf4ac5521d astyle fix 2009-08-28 23:29:08 +03:00
danmar 3b2744e04a borland c++: fixed compiler errors 2009-08-28 10:22:40 +02:00
Slava Semushin 8dcb846627 Fixed #614 (If you see this, there is a bug ###### Token::Match() - varid was 0)
http://sourceforge.net/apps/trac/cppcheck/ticket/614
2009-08-26 02:44:19 +07:00
Slava Semushin 311fb1a1f8 src/checkmemoryleak.{h,cpp}: minor improvements.
Corrections for commit 0d6b6e840d

No functional change.
2009-08-26 02:32:10 +07:00
Slava Semushin ff3d1db480 Replace "const unsigned int" to "unsigned int" in methods parameters.
No functional change.
2009-08-26 02:26:12 +07:00
Daniel Marjamäki 522f4c18c8 astyle formatting 2009-08-23 17:17:57 +02:00
Daniel Marjamäki 9da2ecf4f4 Refactoring the unit testing. Wrote special tests for CheckMemoryLeakInFunction::findleak 2009-08-23 15:48:25 +02:00
Benjamin Kramer 0d6b6e840d Improve performance by using bsearch(3) instead of a std::set
The function name list is already in memory so we can avoid copying it into a std::set
if we sort the list alphabetically. This way no binary search tree has to be allocated.

Before (best of 5 runs):
./testrunner > /dev/null  0,21s user 0,00s system 95% cpu 0,221 total
After (best of 5 runs):
./testrunner > /dev/null  0,20s user 0,00s system 95% cpu 0,210 total
2009-08-22 20:24:26 +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
Daniel Marjamäki 2cdb0abb82 Refactoring: Use the Token::link instead of loop 2009-08-17 22:23:37 +02:00
Daniel Marjamäki 52856fcbeb ettlmartin: improved the MathLib::IsInt 2009-08-16 18:45:26 +02:00
Slava Semushin 522f783ada CheckMemoryLeak: try to speed up call_func().
Using std::set::find() instead of sequence of Match() calls.
2009-08-16 22:02:11 +07: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 cb57bd6678 Listing error messages in XML format 2009-08-04 21:36:55 +02:00
Daniel Marjamäki 9e348ca739 Fixed #554 (resource leak false positive) 2009-08-04 21:34: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
Slava Semushin 65d6bce165 Replace Match() to operator==() from std::string.
No functional change.
2009-07-28 00:13:44 +07:00
Slava Semushin 5ce151983e Replace simpleMatch() to operator==() from std::string.
No functional change.
2009-07-28 00:13:11 +07:00
Slava Semushin 8643936e0c Fixed ticket #500 (Tokenizer: simplify the "(p != NULL)" conditions)
Also teach simplifyIfNot() to handle variables like Foo::var.

https://sourceforge.net/apps/trac/cppcheck/ticket/500
2009-07-25 18:23:03 +07:00
Daniel Marjamäki 9136d8cf80 Tokenizer: simplify return statements - remove redundant parantheses 2009-07-24 21:55:35 +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 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
Reijo Tomperi d2278b5ce0 Fix some of the issues from #478 (Warnings in Visual Studio build with -W4)
http://sourceforge.net/apps/trac/cppcheck/ticket/478
2009-07-20 23:24:23 +03: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
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 4f2520bef3 doxygen: made the todos visible in the doxygen output 2009-07-14 08:17:12 +02:00
Daniel Marjamäki 913789605f refactoring: Refactoring of the leak-checking classes 2009-07-13 15:07:26 +02: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 9beb73824b Fixed #446 (memory leak false positive when variable is static) 2009-07-06 12:20:13 +02:00
Reijo Tomperi 8b0e481d46 Refactoring: Rename member functions to follow naming guidelines. 2009-07-05 23:16:43 +03:00
Daniel Marjamäki 61f4a29758 minor fix of test case 2009-06-23 20:40:27 +02:00
Daniel Marjamäki 7f8b40d135 calling unknown function -> use 2009-06-23 20:37:34 +02:00
Daniel Marjamäki 5c36d33943 astyle formatting 2009-06-21 21:03:58 +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 d1d9c9a9c9 CheckMemoryLeakInClass: Only show the memory leak message when --all is used 2009-06-20 14:17:56 +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 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