Cppcheck
Public Member Functions | Private Member Functions | Static Private Member Functions
CheckMemoryLeakStructMember Class Reference

detect simple memory leaks for struct members More...

#include <checkmemoryleak.h>

Inheritance diagram for CheckMemoryLeakStructMember:
Check CheckMemoryLeak

List of all members.

Public Member Functions

 CheckMemoryLeakStructMember ()
 CheckMemoryLeakStructMember (const Tokenizer *tokenizr, const Settings *settings, ErrorLogger *errLog)
void runSimplifiedChecks (const Tokenizer *tokenizr, const Settings *settings, ErrorLogger *errLog)
 run checks, the token list is simplified
void check ()

Private Member Functions

void checkStructVariable (const Variable *const variable)
void getErrorMessages (ErrorLogger *, const Settings *) const
 get error messages
std::string classInfo () const
 get information about this class, used to generate documentation

Static Private Member Functions

static bool isMalloc (const Variable *variable)
 Is local variable allocated with malloc?
static std::string myName ()

Detailed Description

detect simple memory leaks for struct members

Definition at line 398 of file checkmemoryleak.h.


Constructor & Destructor Documentation

Definition at line 400 of file checkmemoryleak.h.

CheckMemoryLeakStructMember::CheckMemoryLeakStructMember ( const Tokenizer tokenizr,
const Settings settings,
ErrorLogger errLog 
) [inline]

Definition at line 403 of file checkmemoryleak.h.


Member Function Documentation

void CheckMemoryLeakStructMember::checkStructVariable ( const Variable *const  variable) [private]
Todo:
Check how the struct is used. Only bail out if necessary
Todo:
check if the function deallocates the memory
Todo:
check if the function deallocates the memory

Definition at line 2565 of file checkmemoryleak.cpp.

References Check::_tokenizer, Scope::classEnd, Tokenizer::isC(), isMalloc(), Variable::isPointer(), Token::linkAt(), CheckMemoryLeak::Malloc, Token::Match(), CheckMemoryLeak::memoryLeak(), Variable::name(), Variable::nameToken(), Token::next(), Variable::scope(), Token::simpleMatch(), and Variable::varId().

Referenced by check().

std::string CheckMemoryLeakStructMember::classInfo ( ) const [inline, private, virtual]

get information about this class, used to generate documentation

Implements Check.

Definition at line 428 of file checkmemoryleak.h.

void CheckMemoryLeakStructMember::getErrorMessages ( ErrorLogger errorLogger,
const Settings settings 
) const [inline, private, virtual]

get error messages

Implements Check.

Definition at line 421 of file checkmemoryleak.h.

bool CheckMemoryLeakStructMember::isMalloc ( const Variable variable) [static, private]

Is local variable allocated with malloc?

Definition at line 2550 of file checkmemoryleak.cpp.

References Scope::classEnd, Token::Match(), Variable::nameToken(), Token::next(), Variable::scope(), and Variable::varId().

Referenced by checkStructVariable().

static std::string CheckMemoryLeakStructMember::myName ( ) [inline, static, private]

Definition at line 424 of file checkmemoryleak.h.

void CheckMemoryLeakStructMember::runSimplifiedChecks ( const Tokenizer tokenizer,
const Settings settings,
ErrorLogger errorLogger 
) [inline, virtual]

run checks, the token list is simplified

Implements Check.

Definition at line 407 of file checkmemoryleak.h.

References check().


The documentation for this class was generated from the following files: