Catch::LeakDetector: added cleanup call to destructor

simple code with provided main function which just returns 0
leaks memory due to fact that singletons are not cleaned up

running valgrind on such simple application reports that 752 bytes
are still available in 11 blocks

this commit adds destructor to Catch::LeakDetector which calls
Catch::cleanUp()
This commit is contained in:
Jozef Grajciar 2018-10-17 21:05:40 +02:00 committed by Martin Hořeňovský
parent 054d356332
commit ab98afe68b
2 changed files with 6 additions and 0 deletions

View File

@ -6,6 +6,7 @@
*/
#include "catch_leak_detector.h"
#include "catch_interfaces_registry_hub.h"
#ifdef CATCH_CONFIG_WINDOWS_CRTDBG
@ -30,3 +31,7 @@ namespace Catch {
Catch::LeakDetector::LeakDetector() {}
#endif
Catch::LeakDetector::~LeakDetector() {
Catch::cleanUp();
}

View File

@ -11,6 +11,7 @@ namespace Catch {
struct LeakDetector {
LeakDetector();
~LeakDetector();
};
}