Memory leak: minor updates of new leak checking. fixed condition in parseConfiguration. write info message if configuration has been given.
This commit is contained in:
parent
d7c1907601
commit
27003e72b8
|
@ -85,7 +85,7 @@ void CheckLeakAutoVar::doubleDeallocationError(const Token *tok, const std::stri
|
||||||
|
|
||||||
void CheckLeakAutoVar::configurationInfo(const Token* tok, const std::string &functionName)
|
void CheckLeakAutoVar::configurationInfo(const Token* tok, const std::string &functionName)
|
||||||
{
|
{
|
||||||
if (_settings->experimental) {
|
if ((!cfgalloc.empty() || !cfgdealloc.empty()) && _settings->isEnabled("style")) {
|
||||||
reportError(tok,
|
reportError(tok,
|
||||||
Severity::information,
|
Severity::information,
|
||||||
"leakconfiguration",
|
"leakconfiguration",
|
||||||
|
@ -103,7 +103,7 @@ void CheckLeakAutoVar::parseConfigurationFile(const std::string &filename)
|
||||||
while (std::getline(fin,line)) {
|
while (std::getline(fin,line)) {
|
||||||
if (line.compare(0,4,"MEM ",0,4) == 0) {
|
if (line.compare(0,4,"MEM ",0,4) == 0) {
|
||||||
std::string f1;
|
std::string f1;
|
||||||
unsigned int type = 1;
|
enum {ALLOC, DEALLOC} type = ALLOC;
|
||||||
std::string::size_type pos1 = line.find_first_not_of(" ", 4U);
|
std::string::size_type pos1 = line.find_first_not_of(" ", 4U);
|
||||||
while (pos1 < line.size()) {
|
while (pos1 < line.size()) {
|
||||||
const std::string::size_type pos2 = line.find(" ", pos1);
|
const std::string::size_type pos2 = line.find(" ", pos1);
|
||||||
|
@ -115,10 +115,10 @@ void CheckLeakAutoVar::parseConfigurationFile(const std::string &filename)
|
||||||
if (f1.empty())
|
if (f1.empty())
|
||||||
f1 = f;
|
f1 = f;
|
||||||
if (f == ":")
|
if (f == ":")
|
||||||
type = 2;
|
type = DEALLOC;
|
||||||
else if (type == 1)
|
else if (type == ALLOC)
|
||||||
cfgalloc[f] = f1;
|
cfgalloc[f] = f1;
|
||||||
else if (type == 1)
|
else if (type == DEALLOC)
|
||||||
cfgdealloc[f] = f1;
|
cfgdealloc[f] = f1;
|
||||||
pos1 = line.find_first_not_of(" ", pos2);
|
pos1 = line.find_first_not_of(" ", pos2);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue