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
Daniel Marjamäki
d8e8e2c7ee
Memory leaks: Make sure leak is found even when using unknown functions
2009-02-08 18:31:09 +00:00
Daniel Marjamäki
81ed48562c
Memory leak: find memory leak in TestMemleak::unknownFunction2
2009-02-08 18:27:09 +00:00
Daniel Marjamäki
0361c9d338
Memory leak: Handling function that can't be traced into
2009-02-08 11:59:04 +00:00
Daniel Marjamäki
7ee193490f
Memory leaks: Added todo testcase - handle function calls that can't be followed
2009-02-08 08:21:15 +00:00
Reijo Tomperi
b211b8cbe8
Fix ticket #84 (unit testing: use "protected" instead of preprocessor)
2009-02-07 20:06:00 +00:00
Daniel Marjamäki
3c289e52c5
memory allocation: check for mismatching size
2009-02-07 10:54:39 +00:00
Daniel Marjamäki
bb71f9e83e
TestMemleak: fixed problems with wrong linenumbers. This fixes ticket 79
2009-02-07 09:44:57 +00:00
Daniel Marjamäki
67ad1d8c64
TestMemleak: Fixed tests
2009-02-06 18:49:30 +00:00
Daniel Marjamäki
3c7e40fe13
errmsg: use the error message dealloc-use
2009-02-06 06:22:44 +00:00
Daniel Marjamäki
7299d3e5b1
memleak: removed false positives for mismatching allocation and deallocation
2009-02-06 06:11:47 +00:00
Reijo Tomperi
a06861948b
Fixed: Ticket #78 Change (always) into (error) in error messages
2009-02-05 21:06:32 +00:00
Daniel Marjamäki
10abbda6a7
memleak: corrected the wrong line number ( #77 )
2009-02-05 20:17:01 +00:00