From 78d44e67ef02e81ce7e00b057a82a571646bc9b1 Mon Sep 17 00:00:00 2001 From: Slava Semushin Date: Sat, 29 Aug 2009 16:27:56 +0700 Subject: [PATCH] CheckMemoryLeakInFunction(getcode): don't call Token::Match() if varid equals to zero. --- src/checkmemoryleak.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/checkmemoryleak.cpp b/src/checkmemoryleak.cpp index f92e94dee..bf9c67f13 100644 --- a/src/checkmemoryleak.cpp +++ b/src/checkmemoryleak.cpp @@ -627,8 +627,9 @@ Token *CheckMemoryLeakInFunction::getcode(const Token *tok, std::liststr() == ";") addtoken(";"); - if (Token::Match(tok->previous(), "[(;{}] %varid% =", varid) || - Token::Match(tok, "asprintf ( & %varid% ,", varid)) + if (varid && + (Token::Match(tok->previous(), "[(;{}] %varid% =", varid) || + Token::Match(tok, "asprintf ( & %varid% ,", varid))) { AllocType alloc;