Commit Graph

101 Commits

Author SHA1 Message Date
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