Commit Graph

517 Commits

Author SHA1 Message Date
Daniel Marjamäki bd7790fd8c Update copyright year 2019-02-09 07:24:06 +01:00
Daniel Marjamäki a4406aca32 Fixed #7845 (Leak reported when ignoring return value of 'new', even if pointer saved by constructor) 2019-02-03 12:15:05 +01:00
Daniel Marjamäki 35e56942d1 Fixed #8116 ([False positive] Invalid memory leak detection when using reference.) 2019-01-09 20:38:32 +01:00
rikardfalkeborn 036fcf7827 Fix warnings (#1541)
* Fix reorder warning

* Fix override warnings

Clang warns about missing overrides.

* Remove unused function

* Add missing argument to function calls
2018-12-28 12:59:05 +01:00
Daniel Marjamäki 643ddd4caa Code cleanup 2018-12-17 18:54:32 +01:00
Daniel Marjamäki 3b328f9187 CheckMemoryLeak: Cleanup the old memory leaks check 2018-12-17 18:12:50 +01:00
Daniel Marjamäki 9d8e5e36eb Added a few TODO comments 2018-11-20 22:57:01 +01:00
Paul Fultz II 54453c5802 Fix FP when copying pointer to string (#1479) 2018-11-14 06:59:25 +01:00
Daniel Marjamäki 3d629944da Fixed #8100 (False positive when method/function defines lambda with pointer return value) 2018-11-12 11:28:38 +01:00
rikardfalkeborn b3fef7957a Fix FP with fclose after comma (#7525) (#1407) 2018-10-01 11:58:27 +02:00
Daniel Marjamäki ddbe4b89b5 Renamed --debug to --debug-simplified 2018-08-05 11:19:20 +02:00
Daniel Marjamäki c7b787888a Refactoring: Use range for loops 2018-07-14 10:09:12 +02:00
Daniel Marjamäki 86872f81ba Refactorings in CheckMemoryLeak 2018-06-18 09:40:27 +02:00
Daniel Marjamäki 4ba9437bd5 Rename private member variables 2018-06-17 23:09:41 +02:00
Daniel Marjamäki 79ffe1d4fc Rename _tokenizer, _settings, _errorLogger 2018-06-16 16:10:28 +02:00
Daniel Marjamäki 45379a3aa6 Updated copyright year for modified files
[ci skip]
2018-06-10 22:07:21 +02:00
rebnridgway 42a65c5160 Fix crash bug #8579 (#1238)
* Added declaration for deletePrevious function

* Added definition for deletePrevious function

* Fixed crash from deleteThis invalidating pointers

The crash was caused by deleteThis() invalidating the pointer to a constant variable usage.  This happened when a usage followed an assignment.  This fixes bug #8579.

* Added tokensFront to match tokensBack

This means deletePrevious can set the list's front if necessary.

* Initialised tokensFront in appropriate places

* Switched to using default Token constructor

* Switched to using Token default constructor

* Switched to using default constructor for Token

* Added missing argument to Token constructor

* Changed to use default constructor for Tokens

* Switched to using default constructor for Tokens

* Switched to using default constructor for Token

* Added new test for deleting front Token

Also made sure to use the correct constructor for Token in other tests.

* Syntax error

* Replaced tokensFront and tokensBack with a struct

This decreases the size of the Token class for performance purposes.

* Replaced tokensFront and tokensBack with a struct

* Added tokensFrontBack to destructor

* Reworked to use TokensBackFront struct

Also ran astyle.

* Reworked to use TokenList's TokensFrontBack member

* Reworked to use TokensFrontBack struct

* Reworked to use TokensFrontBack struct

* Reworked to work with TokensFrontBack struct

* Removed unnecessary scope operator

* Added missing parentheses

* Fixed syntax error

* Removed unnecessary constructor

* Default constructor now 0-initialises everything

This is safer for not using a temporary TokensFrontBack object, and doesn't use delegating constructors which aren't supported yet.

* Fixed unsafe null check

* Added missing explicit keyword

* Fixing stylistic nits

Removed default constructor as it has been superseded by the single-argument constructor with a default argument value.
Renamed listEnds to tokensFrontBack.
Fixed if statement that was supposed to be adding safety but would actually cause a crash if tokensFrontBack was null.

* Fixing stylistic nits

Removed default constructor and replaced it with a single-argument constructor with a default value.

* Fixing stylistic nits

Renamed _listEnds to _tokensFrontBack.

* Fixing stylistic nits

Renamed _listEnds to _tokensFrontBack.
2018-05-25 07:15:05 +02:00
PKEuS 4d549553b0 Small optimization in checkmemoryleak.cpp: Allow passing literals to addtoken()
Ran AStyle
2018-05-14 10:15:50 +02:00
Daniel Marjamäki ca8e19c96d SymbolDatabase: Refactor SymbolDatabase: variable list 2018-04-28 09:38:33 +02:00
Daniel Marjamäki f336c2efe7 Refactoring; Renamed Scope::classStart and Scope::classEnd 2018-04-27 22:36:30 +02:00
Daniel Marjamäki a0906140a6 Suppressions: New extensible Suppressions xml format that allow more attributes. To start with it also allows symbolName. 2018-04-09 06:43:48 +02:00
PKEuS e2002db78d Replaced make_container by C++11 initializer lists 2018-04-08 23:03:44 +02:00
jrp2014 c5e14ad590 Refactor lib/checkmemoryleak.cpp 2018-04-05 21:41:31 +02:00
Daniel Marjamäki 3ad6c7ebce Refactoring, use early continue 2018-04-05 08:21:43 +02:00
Paul Fultz II 54de7b48c9 Fix false positive when constructing with curly brace (#1148) 2018-04-05 06:47:59 +02:00
jrp2014 b6504c70ca Improve constness 2018-04-04 21:51:31 +02:00
Daniel Marjamäki c4caee6b18 Updated copyright year 2018-01-14 15:37:52 +01:00
Dmitry-Me 82825ab721 Reorder checks, remove duplicate check 2017-12-20 13:16:59 +03:00
Ayaz Salikhov be2c65eb58 Simplify int vs bool 2017-10-08 07:54:39 +02:00
Ayaz Salikhov b8cd7dbb5c Use nullptr instead of 0 or NULL (#936) 2017-08-09 20:00:26 +02:00
Daniel Marjamäki f7514fcd2c Fix issue detected by Coverity, dereference tok3 and then check if its null. 2017-08-02 08:38:36 +02:00
Ayaz Salikhov 28aa939d69 iwyu - include what you use 2017-05-27 04:33:47 +02:00
PKEuS b1f4bd7504 Refactorization: Reimplemented Settings::_enabled as a bitfeld instead of std::set (#7995) 2017-04-11 11:49:26 +02:00
PKEuS 3c8f5b85ae Refactorization: Allocate Token::_values (ValueFlow information) dynamically, reducing size of each token by around 10% 2017-03-27 18:48:34 +02:00
PKEuS 2f0db369f0 Refactorization: Avoid construction of empty strings by using emptyString 2017-03-01 10:50:50 +01:00
Daniel Marjamäki 55d7ab65b9 Fixed #7918 (::exit() not recognized as noreturn) 2017-02-25 12:12:39 +01:00
amai2012 722fac391d Merge pull request #858 from simartin/ticket_7820
Ticket #7820: Properly report leaks with conditional deallocations followed by a return.
2017-01-18 09:31:49 +01:00
Simon Martin 9e76b21d7f Ticket #7820: Properly report leaks with conditional deallocations followed by a return. 2017-01-17 23:02:39 +01:00
Simon Martin ae939b1385 Teach CheckMemoryLeak about "alloc ; loop alloc ;" kinds of patterns. (#861)
Add an optional extended description…
2017-01-15 22:16:23 +01:00
Simon Martin c82d8a0d06 Ticket #7745: Simplify "alloc ; dealloc ;" blocks that we don't have any value for CheckMemoryLeak's analysis. (#860)
Add an optional extended description…
2017-01-15 22:14:37 +01:00
Matthias Krüger 064a4aa4cc improve constness of functions as per cppchecks suggestions. 2017-01-07 14:31:03 +01:00
Daniel Marjamäki 85ae3adeb2 Fixed #5144 (FP old memleak - tree structure) 2016-12-27 08:12:37 +01:00
PKEuS 2f6350a0d0 Refactorized Library 2016-12-06 14:09:28 +01:00
Simon Martin f816fb811e Ticket #7680: Properly handle ::delete during memory leak checks. 2016-09-10 14:55:50 +02:00
orbitcowboy 87409ea6b3 Running astyle; Improved testing of std::find; std.cfg: Added support for istream::read and ifstream::read. 2016-08-25 19:17:07 +02:00
Roberto Martelloni 01ee9ee5e6 CWE mapping of invalidLengthModifierError, leakUnsafeArgAlloc, nullPointerDefaultArg, nullPointerRedundantCheck, raceAfterInterlockedDecrement. 2016-08-24 15:37:14 +01:00
Daniel Marjamäki 54be403f64 Fixed #7026 (Cppcheck does not recognizes the use of a variabile inside lambda function) 2016-05-26 18:07:56 +02:00
Daniel Marjamäki 38741868b5 Fixed #3989 (false positive: memory leak (inline function)) 2016-05-26 17:42:27 +02:00
PKEuS 64d2fd2f57 Added new attribute "arg" to <alloc> and <dealloc> to specify the argument that is allocated/deallocated.
This fixes several issues with allocation functions in windows.cfg, such as HeapAlloc() and VirtualAllocEx() (#7503)
2016-05-22 17:19:14 +02:00
Daniel Marjamäki 5a1bea2a09 Fixed #7244 (False memory leak when POD is allocated with value initialization and pushed onto container) 2016-05-14 14:56:51 +02:00