Oliver Stöneberg
1b4141cbe5
added more missing `sstream` includes ( #4384 )
2022-08-19 18:23:15 +02:00
chrchr-github
d5a0dfda00
Fix #11239 checkLibraryCheckType with asm goto() (invalid varid), add test for #8666 ( #4340 )
...
* Add test for #6541 , avoid duplicate warning
* Add test for #5475
* Fix test
* Merge
* Add test for #8666
* Fix #11239 checkLibraryCheckType with asm goto() (invalid varid)
* Format
2022-08-04 21:35:18 +02:00
chrchr-github
dd927aab9b
Fix #11237 checkLibraryNoReturn with unassigned object ( #4338 )
...
* Handle float values
* Fix #11237 checkLibraryNoReturn with unassigned object
2022-08-03 19:04:10 +02:00
chrchr-github
304e448749
Fix #8476 --check-library reports missing configuration for static_assert ( #4314 )
2022-07-28 22:47:15 +02:00
chrchr-github
3fc276fb51
Add test for #11061 ( #4307 )
2022-07-26 11:14:35 +02:00
chrchr-github
479533a80a
Rework fix for #11008 ( #4296 )
2022-07-24 12:15:04 +02:00
chrchr-github
5e537a666f
Fix --check-library warning for int(i) ( #4293 )
2022-07-19 20:41:18 +02:00
chrchr-github
c736fe8787
Fix #11008 FP doubleFree with pointer in struct ( #4294 )
2022-07-19 20:41:08 +02:00
chrchr-github
63e567eb50
Remove simplifyKnownVariables() ( #4232 )
...
* Remove simplifyKnownVariables()
* Add some test cases back
* Remove unused functions
* Format
2022-06-25 08:38:17 +02:00
chrchr-github
16a4449901
Fix crash with statement expression ( #4142 )
2022-05-28 00:11:23 +02:00
Rikard Falkeborn
068e5bad27
Fix #9966 : FP memleak with multiple assignments in if-statement ( #4138 )
...
Similar to how we do for assignments outside if-statements, bail out
since we do not track multiple variables.
2022-05-27 07:57:43 +02:00
chrchr-github
e9a0d7979e
Fix #11014 FN redundantPointerOp / remove simplifyMulAndParens() ( #4062 )
2022-05-01 15:46:07 +02:00
chrchr-github
0467ab1339
Fix #7923 FN memleak with cfg ( #4060 )
2022-04-28 19:50:16 +02:00
chrchr-github
3d3885d151
Add test for #9838 / Remove noisy assert ( #4059 )
...
* Add test for #9838
* Remove noisy assert
2022-04-28 15:24:54 +02:00
chrchr-github
18a7a805df
Fix #10502 FP doubleFree ( #3921 )
2022-03-21 22:17:50 +01:00
Binho
8b3647edd7
Fix false positive in memory leak
2022-03-10 08:29:05 +01:00
chrchr-github
2f46e57311
Add leak-ignore for fopen_s(), test cases ( #3839 )
...
* Add leak-ignore for fopen_s(), test cases
* Format
2022-02-17 16:22:30 +01:00
chrchr-github
a1adbff683
Fix #1733 FN Memory leak not detected when variable is 'used' by allocation function in condition ( #3838 )
2022-02-16 21:31:24 +01:00
chrchr-github
a5674182bb
Add test for #5473 ( #3831 )
2022-02-15 12:52:10 +01:00
Oliver Stöneberg
f32583e097
removed OVERRIDE and FINAL defines and use the keywords directly ( #3767 )
2022-02-10 23:02:24 +01:00
Daniel Marjamäki
3989408738
Update copyright year
2022-02-05 11:45:17 +01:00
chrchr-github
dad64bfcc8
Fix #10091 FP shadowFunction with default destructor implementation / Tests for #8635 , #9776 , #9940 , #9951 , #10018 ( #3763 )
2022-02-02 19:30:49 +01:00
Oliver Stöneberg
171da2e6f9
avoid dependency on transitive includes - based on include-what-you-use ( #3757 )
2022-01-27 19:03:20 +01:00
chrchr-github
4d44d0c079
Fix #9781 FP deallocuse after auto_ptr ( #3724 )
2022-01-19 21:39:45 +01:00
Paul Fultz II
55ff010df3
Fix 10717: Crash in SymbolDatabase::setValueTypeInTokenList ( #3710 )
...
* Fix 10717: Crash in SymbolDatabase::setValueTypeInTokenList
* Format
2022-01-15 07:56:56 +01:00
chrchr-github
d565cde815
Fix and tests for #7622 , #10381 , #10382 ( #3588 )
...
* Add test cases for #10381 , #10382
* Fix #7622
* Format
2021-11-29 22:51:35 +01:00
chrchr-github
ca311ebcdf
ASSERT() on calls to Tokenizer::tokenize() in test code ( #3501 )
2021-11-29 07:34:39 +01:00
Paul Fultz II
7f358b2bed
Format with uncrustify ( #3388 )
2021-08-07 20:51:18 +02:00
Paul Fultz II
8efe1d4ab4
Find reference to dangling unique ptr ( #3344 )
2021-07-20 21:30:27 +02:00
chrchr-github
8cd8b9c64e
Fix MSVC build and some warnings ( #3334 )
2021-07-16 21:55:12 +02:00
Rikard Falkeborn
b013f1b3d0
Fix test case for #10186 ( #3253 )
2021-05-10 08:01:30 +02:00
Daniel Marjamäki
42437277dc
Update Copyright year
2021-03-21 20:58:32 +01:00
Rikard Falkeborn
27316e04ed
Fix #10187 (memleak open with fd >= 0) ( #3156 )
2021-03-03 07:00:28 +01:00
Rikard Falkeborn
42a41e8b41
Fix #9139 (leak when variable has const qualifier) ( #3159 )
...
Also, in the tests, change socket/close to resource to get error
messages which say "resource leak" instead of "memory leak".
2021-03-03 06:58:38 +01:00
Rikard Falkeborn
c3eb37972d
Fix #10182 (FN memory leak with if-statement) ( #3151 )
...
Improve leak detections in if-statements. This is done by checking
for leaks every time a scope is left. This allows cppcheck to catch
more memory leaks, as well as improve some error messages which now
contain the line where the variable goes out of scope, instead of the
end of the function.
2021-02-26 12:58:52 +01:00
Rikard Falkeborn
951ca2c8b9
Fix #10186 (FP memleak with cast and assignment) ( #3148 )
2021-02-25 10:55:34 +01:00
PKEuS
141d2ac215
Refactorization: Improved internal implementation of severity and certainty levels
...
Backported from LCppC.
2021-02-24 22:00:06 +01:00
PKEuS
4b01d5bdc6
Re-enabled a bunch of disabled unit tests, some as TODO tests
...
Merged from LCppC.
2021-02-20 13:02:14 +01:00
PKEuS
cf1937294a
Refactorization: Removed unnecessary \n and spaces in strings
...
Merged from LCppC.
2021-02-20 12:58:42 +01:00
Rikard Falkeborn
f018163551
Improve handling of realloc in memory leak checker ( #3036 )
...
Mark realloced variables as realloced instead of freed. This allows
improved checking for code with error realloc handling.
If cppcheck finds an if-statement which checks the validity of the
allocated memory or resource, check if the memory/resource is
reallocated from another variable. If so, we can add checking of that
variable in the if-statement instead. This allows to check that variable
for memleaks and double frees.
This fixes #9292 and #9990 which both concern FPs with double frees
after correct error handling.
2021-01-11 07:55:05 +01:00
Rikard Falkeborn
fb35756126
TestLeakAutoVar: Split recursiveCountLimit test to separate class ( #2995 )
...
This test is by far the slowest one to run. Split it to a separate class
to make it easy to select if it should be run during development.
2020-12-31 09:34:53 +01:00
Ken-Patrick Lehrmann
79bdd64689
Fix false positive memoryleak ( #2882 )
...
```
int *f() {
int *p = static_cast<int *>(realloc(nullptr, 10));
if (!!(!p)) {
return nullptr;
}
return p;
}
```
would give
```
memleak2.cpp:4:5: error: Memory leak: p [memleak]
return nullptr;
^
```
Because of the additional `!!̀ .
2020-11-10 15:59:51 +01:00
Daniel Marjamäki
6d0b78433b
astyle formatting
2020-10-29 21:43:56 +01:00
Rikard Falkeborn
de19dc9e3e
Fix #8327 (Memleak with mmap return value check) ( #2864 )
...
Also fix a broken test case related to checking the return value -1
where socket was not defined in the library used in the tests.
This was tested running test-my-pr with 500 packages. The difference was
six fewer FPs.
2020-10-29 13:17:33 +01:00
Rikard Falkeborn
1e679cc5d1
Fix #9635 (FP: Memory leak with comma operator in if-statement)
...
When checking for comparisons in if-statements, if there are comma
operators in the if-statement, skip until after the last comma.
2020-07-09 21:31:43 +02:00
Rikard Falkeborn
4996ec190e
Fix #9652 (fp memleak with function call with cast)
...
When the first argument was (void *)(1), at the start of the second
iteration, arg was pointing to the "1", which caused problems for
nextArgument(), which saw the ")" as the next token and returned
nullptr, signalling that there are no more arguments.
Instead, save the first token in the argument, which makes
nextArgument() do the right thing.
2020-07-08 00:02:39 +02:00
orbitcowboy
9861a5291e
Formatted the code, there are no functional changes [ci skip]
2020-05-20 23:45:00 +02:00
PKEuS
fb1afe2345
Fixed test suite: Do no longer apply simplifyTokenList2 to token lists, except for those tests that test those simplifications, because checks are no longer run on that simplified token list
...
Changed failing unit test to TODO tests, as they indicate patterns we do no longer understand properly.
2020-05-20 18:54:16 +02:00
PKEuS
c9d8f607df
Optimization: Reduced peak memory usage (30% in my test case) by immediately deleting simplecpp::TokenList while creating the cppcheck TokenList.
2020-05-19 12:08:17 +02:00
Daniel Marjamäki
08ddd84780
Update copyright year
2020-05-10 11:16:32 +02:00