From 53b549b63158c64a2f8764fcba8bf049fb1cb397 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Fri, 21 Dec 2018 01:45:47 +0100 Subject: tests: call the derived Test class cleanup() function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Calling the cleanup() function in the base class Test destructor only calls the base class empty cleanup() function, not the overloaded one. This results in tests not cleaning up after themself. Solve this by explicitly calling the cleanup() function from execute(). This was discovered while running valgrind on tests where objects where allocated in init() and freed in cleanup(). Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart Signed-off-by: Laurent Pinchart --- test/test.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test.cpp b/test/test.cpp index 4e7779e7..1bb6ebcb 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -13,7 +13,6 @@ Test::Test() Test::~Test() { - cleanup(); } int Test::execute() @@ -24,5 +23,9 @@ int Test::execute() if (ret < 0) return ret; - return run(); + ret = run(); + + cleanup(); + + return ret; } -- cgit v1.2.1