Ensure last XML is freed after tests.
This fixes undetected memory leaks in tests calling mj_loadXML. Additionally, a specific test for `mj_freeLastXML` is introduced. PiperOrigin-RevId: 764294041 Change-Id: I8b5a5683d8431ed920cdd52b06ad3515d8e19e14
This commit is contained in:
committed by
Copybara-Service
parent
18b0e68a5a
commit
287f46b220
@@ -53,6 +53,9 @@ class MujocoErrorTestGuard {
|
||||
// By default, any MuJoCo operation which triggers a warning or error will
|
||||
// trigger a test failure.
|
||||
class MujocoTest : public ::testing::Test {
|
||||
public:
|
||||
~MujocoTest() { mj_freeLastXML(); }
|
||||
|
||||
private:
|
||||
MujocoErrorTestGuard error_guard;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user