diff --git a/src/checkmemoryleak.cpp b/src/checkmemoryleak.cpp index 51ed917ee..0611d5e17 100644 --- a/src/checkmemoryleak.cpp +++ b/src/checkmemoryleak.cpp @@ -275,7 +275,7 @@ CheckMemoryLeak::AllocType CheckMemoryLeak::getDeallocationType(const Token *tok //-------------------------------------------------------------------------- -void CheckMemoryLeak::memoryLeak(const Token *tok, const std::string varname, AllocType alloctype, bool all) +void CheckMemoryLeak::memoryLeak(const Token *tok, const std::string &varname, AllocType alloctype, bool all) { if (alloctype == CheckMemoryLeak::File || alloctype == CheckMemoryLeak::Pipe || @@ -1662,7 +1662,7 @@ const Token *CheckMemoryLeakInFunction::findleak(const Token *tokens, bool all) // Check for memory leaks for a function variable. -void CheckMemoryLeakInFunction::checkScope(const Token *Tok1, const std::string varname, unsigned int varid, bool classmember, unsigned int sz) +void CheckMemoryLeakInFunction::checkScope(const Token *Tok1, const std::string &varname, unsigned int varid, bool classmember, unsigned int sz) { std::list callstack; diff --git a/src/checkmemoryleak.h b/src/checkmemoryleak.h index efcb4140d..418b57b41 100644 --- a/src/checkmemoryleak.h +++ b/src/checkmemoryleak.h @@ -84,7 +84,7 @@ public: /** What type of allocation are used.. the "Many" means that several types of allocation and deallocation are used */ enum AllocType { No, Malloc, gMalloc, New, NewArray, File, Fd, Pipe, Dir, Many }; - void memoryLeak(const Token *tok, const std::string varname, AllocType alloctype, bool all); + void memoryLeak(const Token *tok, const std::string &varname, AllocType alloctype, bool all); /** * Get type of deallocation at given position @@ -245,7 +245,7 @@ private: * @param classmember is the scope inside a class member function * @param sz size of type.. if the variable is a "int *" then sz should be "sizeof(int)" */ - void checkScope(const Token *Tok1, const std::string varname, unsigned int varid, bool classmember, unsigned int sz); + void checkScope(const Token *Tok1, const std::string &varname, unsigned int varid, bool classmember, unsigned int sz); void getErrorMessages() {