File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -97,6 +97,7 @@ void CheckOther::checkZeroDivision()
9797
9898#ifdef _WIN32
9999#include < windows.h>
100+ static char exename[1024 ] = {0 };
100101#endif
101102
102103/* *
@@ -115,7 +116,6 @@ int main(int argc, char* argv[])
115116
116117 CppCheckExecutor exec;
117118#ifdef _WIN32
118- char exename[1024 ] = {0 };
119119 GetModuleFileNameA (NULL , exename, sizeof (exename)/sizeof (exename[0 ])-1 );
120120 argv[0 ] = exename;
121121#endif
Original file line number Diff line number Diff line change @@ -425,14 +425,12 @@ CheckMemoryLeak::AllocType CheckMemoryLeak::functionReturnType(const Function* f
425425 if (varid == 0 )
426426 return No;
427427
428- if (this != nullptr ) {
429- // If variable is not local then alloctype shall be "No"
430- // Todo: there can be false negatives about mismatching allocation/deallocation.
431- // => Generate "alloc ; use ;" if variable is not local?
432- const Variable *var = tokenizer->getSymbolDatabase ()->getVariableFromVarId (varid);
433- if (!var || !var->isLocal () || var->isStatic ())
434- return No;
435- }
428+ // If variable is not local then alloctype shall be "No"
429+ // Todo: there can be false negatives about mismatching allocation/deallocation.
430+ // => Generate "alloc ; use ;" if variable is not local?
431+ const Variable *var = tokenizer->getSymbolDatabase ()->getVariableFromVarId (varid);
432+ if (!var || !var->isLocal () || var->isStatic ())
433+ return No;
436434
437435 // Check if return pointer is allocated..
438436 AllocType allocType = No;
Original file line number Diff line number Diff line change @@ -289,10 +289,11 @@ Library::Error Library::load(const tinyxml2::XMLDocument &doc)
289289
290290 else if (strcmp (markupnode->Name (), " codeblocks" ) == 0 ) {
291291 for (const tinyxml2::XMLElement *blocknode = markupnode->FirstChildElement (); blocknode; blocknode = blocknode->NextSiblingElement ()) {
292- if (strcmp (blocknode->Name (), " block" ) == 0 )
293- _executableblocks[extension].addBlock (blocknode->Attribute (" name" ));
294-
295- else if (strcmp (blocknode->Name (), " structure" ) == 0 ) {
292+ if (strcmp (blocknode->Name (), " block" ) == 0 ) {
293+ const char * name = blocknode->Attribute (" name" );
294+ if (name)
295+ _executableblocks[extension].addBlock (blocknode->Attribute (" name" ));
296+ } else if (strcmp (blocknode->Name (), " structure" ) == 0 ) {
296297 const char * start = blocknode->Attribute (" start" );
297298 if (start)
298299 _executableblocks[extension].setStart (start);
You can’t perform that action at this time.
0 commit comments