Commit Graph

607 Commits

Author SHA1 Message Date
PKEuS 3b4160600d Fixed crash in CheckMemoryLeak::functionReturnType() for unary operator:: (#7172) 2015-11-27 11:18:40 +01:00
PKEuS 0ba3d25917 CheckMemoryLeak: Correctly detect new char[...]() as array allocation (#7164) 2015-11-27 11:04:18 +01:00
PKEuS c5b21d12cf Removed lots of redundant tests from testmemleak.cpp, added some missing types to gtk.cfg 2015-11-19 18:51:32 +01:00
PKEuS 2e7c5d37df Refactorizations in checkmemoryleak.cpp:
- Rely more on <alloc> declarations in Libraries
- Removed unreachable debug message
- Simplified code
2015-11-19 17:34:17 +01:00
PKEuS 0d25a43a5d checkmemoryleak.cpp: Refactorized CheckMemoryLeakNoVar::check() and replaced a redundant whitelist by CheckMemoryLeakInFunction::test_white_list() 2015-11-19 17:34:17 +01:00
PKEuS ab171fc027 Fixed false negatives in CheckMemoryLeakStructMember::checkStructVariable():
- Use generic detection of allocation/deallocation (#4770)
- Make the checker usable for C++ by checking for destructors
- Reduced unit test duplication
2015-11-19 16:10:26 +01:00
PKEuS db6174bb60 Refactorization: Support Types that consist of more than a single token in CheckMemoryLeakNoVar::checkForUnsafeArgAlloc
Removed obsolete comments
2015-11-19 16:10:26 +01:00
PKEuS 87d3ed91ab Refactorization:
- Improved and cleaned up CheckMemoryLeak::functionReturnType()
- Cleaned up whitelist from functions declared as <leak-ignore/> in std.cfg
2015-11-18 22:09:27 +01:00
PKEuS 6ee4cf80dc Improved detection of new operator in checkmemoryleak.cpp, fixed TODO unit test 2015-11-18 20:33:39 +01:00
Daniel Marjamäki 0f9d90d2be Changed Copyrights. Removed my name. 2015-11-18 20:04:50 +01:00
PKEuS 6336372fb4 Apply same heuristics in CheckMemoryLeakNoVar::checkForUnusedReturnValue() as in CheckOther::checkIgnoredReturnValue(): Ensure that a defined function has non-void return value. (#6693) 2015-11-10 14:19:45 +01:00
PKEuS 3a5cef8a7e Refactorization: Improved usage of Settings instances in test suite 2015-10-07 18:40:03 +02:00
PKEuS 93dbfb72d1 Improved REGISTER_TEST() macro to support several occurrences within a single file 2015-10-07 14:30:01 +02:00
PKEuS 07b661ef62 Refactorization: Improved handling of preprocessor in test suite
- Set Preprocessor::macroChar to '$' once in the beginning to avoid problems when changing the order of tests
- Removed Preprocessor usage from where it is not required
- Fixed a TODO in testuninitvar.cpp
2015-10-07 14:18:57 +02:00
PKEuS ab8afec3eb Refactorizations:
- Avoid unnecessary loop iterations
- Avoid unnecessary condition checking
- Reduced code duplication in symboldatabase.cpp
2015-08-16 14:23:07 +02:00
Martin Ettl 716b4d6e18 Another attempt to fix the current travis build. Improved testing of std.cfg. 2015-08-16 01:21:11 +02:00
Martin Ettl ab0862f218 std.cfg: Fixed travis build. Added noreturn to the assert-definition in std.cfg. Improved testing of std.cfg. 2015-08-16 01:09:03 +02:00
Matthias Krüger 8bfbb5d09c CheckMemoryLeakNoVar::returnValueNotUsedError: put function name into singlequotes 2015-07-31 15:29:07 +02:00
Alexander Mai a36b544995 #3991 false positive: Memory leak (allocation function returns success/failed code). Add testcase. Issue had been fixed in 1.69 already 2015-07-25 18:50:27 +02:00
Simon Shanks 9910c1fa0c Fixed #6617 (preprocessor performance improvement) 2015-07-24 13:30:41 +02:00
Daniel Marjamäki 234669b02b Removed the UninitVar::analyseFunctions(). This was written for multifile checking however it did not work as it should => no multifile errors can be detected. 2015-07-24 08:30:38 +02:00
Alexander Mai 2c73518e29 Fix platform-dependent test result, formatting and crash in whole program analysis 2015-06-28 17:54:48 +02:00
amai2012 4a47b8b3ae Refactoring: Better distinguish between C and C++ in a few checks. 2015-06-28 16:49:16 +02:00
Simon Martin cba0583045 Ticket #6536: Properly handle variables whose name is that of an allocation function. 2015-06-19 23:48:40 +02:00
PKEuS 4e5c5eb238 Fixed #5665: Recognize free() with more than one parameter 2015-04-09 20:50:19 +02:00
PKEuS bc5132e0ac Refactorization: Moved declaration of errout, ... to testsuite.h, uniformized style 2015-03-11 22:54:43 +01:00
Daniel Marjamäki fe8ba51f03 TestMemLeak: moved posix.cfg tests 2015-02-15 18:11:09 +01:00
Daniel Marjamäki adedb5a888 TestMemLeakInFunction: Moved test to cfg test 2015-02-15 15:56:05 +01:00
PKEuS 54b6b8e571 Fixed false positive #6481 2015-01-31 20:34:06 +01:00
PKEuS ae4b86c231 Several improvements to CheckMemoryLeakNoVar::checkForUnusedReturnValue():
- Support user defined functions (solves TODO tests)
- Print message if return value is not stored properly (adapted message text, #6458)
2015-01-31 17:28:03 +01:00
PKEuS 03e44d4aa0 CheckMemoryLeakInFunction: Don't treat delete as delete operator for C code
Fixed GCC message in checkbufferoverrun.cpp
2015-01-30 20:55:53 +01:00
PKEuS 3274a00b82 Moved some more tests to testgarbage.cpp 2015-01-21 10:04:46 +01:00
Martin Ettl 910af75e3a testmemleak: Added missing () in test case. 2015-01-11 10:27:37 +01:00
Martin Ettl 37c89a6b70 Fixed #6311: Add support for GNU get_current_dir_name(). 2015-01-11 10:12:39 +01:00
Daniel Marjamäki a80101f277 CheckMemoryLeak: Fix FP for allocation functions that register memory before returning it 2015-01-05 13:23:38 +01:00
Daniel Marjamäki f94243f85e CheckMemoryLeak: Fix fp for allocation function that returns success value 2015-01-04 11:46:26 +01:00
Zachary Blair 22bd20c94a New check: Use make_shared/make_unique (#5673) 2015-01-04 11:07:53 +01:00
Daniel Marjamäki ff11ba9847 Updated copyright year to 2015 2015-01-03 12:14:58 +01:00
Thomas Jarosch 6b78ae7c46 Add mmap() / mmap64() / munmap() to posix.cfg. Enables basic leak tracking
Includes function prototype in posix.cfg as comment
for easier overview of the function arguments.
2014-12-14 13:30:24 +01:00
orbitcowboy ac4f7879db posix.cfg: Added support for rewinddir(). 2014-12-10 16:10:03 +01:00
Thomas Jarosch 269a4419f0 Fixed false positives about strdupa() / strndupa() memleak
strdupa() / strndupa() allocates memory on the stack using alloca().
This memory is freed automatically once the current function is left.
2014-12-10 22:23:52 +01:00
Frank Zingsheim 9497732ac8 Fixed #6238 (false positive with double fopen) 2014-11-20 22:19:39 +01:00
Daniel Marjamäki 051d42ae6b astyle formatting 2014-11-20 14:20:09 +01:00
orbitcowboy f5d804f71a running astyle 2014-11-20 10:13:03 +01:00
Daniel Marjamäki 8012ac9562 Fixed #5993 (FP: memleak (linux list)) 2014-11-07 07:44:12 +01:00
PKEuS 6955e719cf Collected garbage code tests and moved them to testgarbage.cpp 2014-10-16 10:59:46 +02:00
PKEuS 7c7fcf36af Support :: prefix in front of allocation function. 2014-10-01 15:33:03 +02:00
PKEuS 8788e58cbb Fixed false positive #5327: fclose as inner function call 2014-09-30 13:55:21 +02:00
PKEuS c0e2adf723 Detect "var += fclose(f)" as deallocation (fixes false positive #6016) 2014-09-30 13:19:53 +02:00
PKEuS e1218cf846 Support allocation of array of pointers with operator new in checkmemoryleak.cpp 2014-09-27 11:25:08 +02:00
PKEuS 0a416910c4 Improved speed of testrunner: Avoid repeated loading of the same library 2014-09-10 20:29:44 +02:00
PKEuS 2d608890a5 Improved message 'mismatchSize' (#4167) 2014-09-02 09:38:40 +02:00
PKEuS 40e5dab9dc Refactorization in checkmemoryleak.cpp:
- Use Library to detect noreturn/notnoreturn functions
- Removed realloc from std.cfg as long as there is no proper way to configure such functions
2014-09-01 13:54:33 +02:00
Pierre Schweitzer 1cf2e36dd5 Add a new test for OpenFile function from windows.cfg.
It is here as a reminder for a TODO. When used with OF_EXIST flag, the function OpenFile doesn't return a handle and thus, doesn't leak any resource.
As cppcheck doesn't support such feature yet, it's added a TODO not to be forgotten for later fix when cppcheck supports this.

Also added a naive check, just to ensure the OpenFile check doesn't get broken when adding support for OF_EXIST.
2014-06-01 00:00:49 +02:00
PKEuS 01a0154daa Fixed false positive #5848 2014-05-21 13:45:36 +02:00
Simon Martin 512e22d1ba Ticket #5315: Memory leak analysis confused by ((variable).attribute) notation. 2014-05-08 20:58:24 +02:00
Daniel Marjamäki 44a66e6a5a Fixed #1416 (false negative resource leak when calling fdopen) 2014-04-20 10:50:32 +02:00
Daniel Marjamäki a9943fe6d0 Fixed #5525 (Closing a socket file descriptor gives an error: Mismatching allocation and deallocation) 2014-04-18 17:05:44 +02:00
Robert Reif 7eb3988415 Fixed #5659 (False negative: mismatching allocation / deallocation whith using namespace) 2014-04-11 05:40:37 +02:00
Robert Reif 4ae204e46b Fixed #5659 (False negative: mismatching allocation / deallocation whith using namespace) 2014-04-10 16:11:11 +02:00
Daniel Marjamäki d7e2e3bd5e Fixed #5502 (FP: Dereferencing 'b' after it is deallocated / released) 2014-04-06 18:45:24 +02:00
PKEuS d4765bccc3 Refactorized inefficient usage of std::string and const char[] (part 2). 2014-04-03 14:56:14 +02:00
PKEuS e9411e05ba Refactorized inefficient usage of std::string and const char[]. 2014-04-02 13:56:34 +02:00
PKEuS 7e4081f7f5 Treat syntaxError and cppcheckError as InternalErrors (throw as exception, #4268) 2014-03-27 13:15:21 +01:00
PKEuS 9b4b90f6a0 Avoid loading libraries multiple times in test suite
-> Massive speedup for test suite (especially on slow systems)
2014-03-24 09:59:05 +01:00
Daniel Marjamäki 06618b31bb Fixed #5574 (False positive: mismatchAllocDealloc using realloc() and free) 2014-03-17 16:10:54 +01:00
Daniel Marjamäki 23efc68dd7 use nullptr 2014-02-16 10:32:10 +01:00
Daniel Marjamäki fd3a8a2a18 Update copyright 2014-02-15 07:45:39 +01:00
Pavel Roschin df69f4e4be Library: add mk[sd]temp to Posix 2014-02-11 17:02:33 +04:00
Daniel Marjamäki 8305015dea astyle formatting 2014-02-08 08:51:38 +01:00
Pavel Roschin 19a8cfd960 Library: add new "define" tag
This tag will allow to add some preprocessor defs into library.
It would be useful to provide more information about libraries
implementation details. As example GLib's library include tag
was added that helps to detect more memory leaks.
2014-02-07 10:13:36 +04:00
Daniel Marjamäki 3c0619cba5 astyle formatting 2014-02-05 18:49:34 +01:00
Pavel Roschin 4f38d7ae31 Library: add full GLib/GTK support 2014-02-05 19:52:24 +04:00
Pavel Roschin 0dd227419d CheckMemoryLeak: use library while checking whitelist functions 2014-02-05 12:16:50 +04:00
Daniel Marjamäki 8c40f4fee0 astyle formatting 2014-02-03 18:51:07 +01:00
Daniel Marjamäki ed4fa9f154 Merge pull request #231 from scriptum/rpg-add-glib-tests
Add GLib library, add GLib tests (some new bugs found)
2014-02-02 10:49:33 -08:00
Pavel Roschin 651ebcf17b Add GLib library, add GLib tests (some new bugs found) 2014-02-02 22:45:57 +04:00
Pavel Roschin e06e96e864 Added regression for #3236 (Failure to detect memory leak if pointer members are added) 2014-02-01 15:51:29 +04:00
Daniel Marjamäki 30b56437c1 Merge pull request #226 from scriptum/rpg-fix-function-parameter
CheckMemoryLeak: improve leak checking in function parameters
2014-01-28 20:32:56 -08:00
Pavel Roschin 2396073262 CheckMemoryLeak: improve leak checking in function parameters 2014-01-28 17:30:36 +04:00
Daniel Marjamäki 6e6de82323 CheckMemoryLeak: test alloc/dealloc configuration in posix.cfg 2014-01-27 16:51:18 +01:00
Daniel Marjamäki 2b8cf462c9 CheckMemoryLeak: Move posix-opendir/closedir to library 2014-01-26 17:02:36 +01:00
Simon Martin 6019f45249 Ticket #5201: Get rid of internal error when checking valid C input for memory leaks. 2014-01-03 23:27:56 +01:00
Zachary Blair 7a6386bc4b Fixed #4867 (Memory Leak: Return value of malloc) 2014-01-03 10:12:32 +01:00
PKEuS 4f0121ee2f Splitted simplification out of tokenize() 2013-12-30 17:45:28 +01:00
Daniel Marjamäki e13aa0dbc3 Fixed #5275 (FP mismatchAllocDealloc: user defined opendir()/closedir() on non-POSIX system) 2013-12-29 09:51:29 +01:00
Daniel Marjamäki 57ecdd693c Fixed #5149 (false positive: (error) Dereferencing 'memory' after it is deallocated / released) 2013-12-14 07:37:24 +01:00
Alexander Mai 6eab4abaf2 Fixed #5030 (Segmentation fault below CheckMemoryLeakStructMember::isMalloc()) 2013-09-21 18:10:29 +02:00
PKEuS a9a5dc0354 Updated to AStyle 2.03, require this version 2013-08-07 16:27:37 +02:00
Daniel Marjamäki 807204e580 Fixed #4237 (False positive: (error) Memory Leak: data (references and pointer aliases)) 2013-07-30 11:30:14 +02:00
Daniel Marjamäki 61e1dd5096 Environment: Refactoring and cleanup 2013-07-05 20:55:31 +02:00
Daniel Marjamäki 1a35241aa2 testrunner: removed redundant ';' 2013-06-30 19:44:12 +02:00
Daniel Marjamäki 582e0ee7e7 testrunner: Added REGISTER_TEST. Thanks lucasmrod. 2013-06-30 19:42:26 +02:00
Daniel Marjamäki 6b2bab535b CLI,LIB: Added --std setting for GTK 2013-06-29 12:55:24 +02:00
Daniel Marjamäki ae7363fe54 Fixed #4599 (False positive with fopen/fclose test) 2013-05-23 06:34:22 +02:00
Daniel Marjamäki cf75e2bb28 astyle formatting 2013-04-30 06:44:50 +02:00
Baris Demiray 548dd42aaf Fixed #933 (Leaks with struct members not detected) 2013-04-26 16:11:57 +02:00
XhmikosR 700512a53f use spaces in strings 2013-04-09 17:49:09 +02:00
Ettl Martin 3e8eddc69e cleanup testcases: moved testcases from #3888 into allocfunc13 which contains similar testcases already. 2013-04-03 10:12:36 +02:00
Ettl Martin 9f25b618dc #3888 added a testcase 2013-04-03 08:57:26 +02:00