From 896abcb56903326e1dde973827773a1643e105bb Mon Sep 17 00:00:00 2001 From: Reijo Tomperi Date: Tue, 17 Mar 2009 21:59:40 +0200 Subject: [PATCH] Fixed some memory leaks in test cases --- Makefile | 2 +- test/testmemleakmp.cpp | 1 + test/testtoken.cpp | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d2c84c461..d1a3c2f96 100644 --- a/Makefile +++ b/Makefile @@ -217,7 +217,7 @@ test/teststl.o: test/teststl.cpp src/tokenize.h src/settings.h src/errorlogger.h test/testsuite.o: test/testsuite.cpp test/testsuite.h src/errorlogger.h src/settings.h $(CXX) $(CXXFLAGS) -c -o test/testsuite.o test/testsuite.cpp -test/testtoken.o: test/testtoken.cpp test/testsuite.h src/errorlogger.h src/settings.h src/token.h +test/testtoken.o: test/testtoken.cpp test/testsuite.h src/errorlogger.h src/settings.h src/tokenize.h src/token.h $(CXX) $(CXXFLAGS) -c -o test/testtoken.o test/testtoken.cpp test/testtokenize.o: test/testtokenize.cpp test/testsuite.h src/errorlogger.h src/settings.h src/tokenize.h src/token.h diff --git a/test/testmemleakmp.cpp b/test/testmemleakmp.cpp index 698ef14d9..9a01f4d78 100644 --- a/test/testmemleakmp.cpp +++ b/test/testmemleakmp.cpp @@ -78,6 +78,7 @@ private: for (const Token *tok2 = tok; tok2; tok2 = tok2->next()) s += tok2->str() + " "; ASSERT_EQUALS("; } ", s); + Tokenizer::deleteTokens(tok); } }; diff --git a/test/testtoken.cpp b/test/testtoken.cpp index 429d0fbb1..1f5c8dcb6 100644 --- a/test/testtoken.cpp +++ b/test/testtoken.cpp @@ -19,6 +19,7 @@ #include #include "testsuite.h" +#include "../src/tokenize.h" #include "../src/token.h" extern std::ostringstream errout; @@ -54,6 +55,8 @@ private: ASSERT_EQUALS(last->previous()->previous()->str(), "1"); if (token->previous()) ASSERT_EQUALS("Null was expected", ""); + + Tokenizer::deleteTokens(token); }